Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pubsub): implement GUAC for SubscriptionAdmin #7432

Merged

Conversation

coryan
Copy link
Contributor

@coryan coryan commented Oct 9, 2021

Part of the work for #6463


This change is Reviewable

@product-auto-label product-auto-label bot added the api: pubsub Issues related to the Pub/Sub API. label Oct 9, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Oct 9, 2021
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: dc04ccc92d51277a2751d8a9370a9903a500e3f7

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@codecov
Copy link

codecov bot commented Oct 9, 2021

Codecov Report

Merging #7432 (1222e6f) into main (1a2ddfb) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7432      +/-   ##
==========================================
+ Coverage   93.61%   93.63%   +0.01%     
==========================================
  Files        1356     1359       +3     
  Lines      117762   118117     +355     
==========================================
+ Hits       110248   110602     +354     
- Misses       7514     7515       +1     
Impacted Files Coverage Δ
google/cloud/pubsub/internal/subscriber_stub.h 100.00% <ø> (ø)
...ogle/cloud/internal/async_read_write_stream_impl.h 92.53% <100.00%> (+1.46%) ⬆️
...loud/internal/async_read_write_stream_impl_test.cc 96.96% <100.00%> (+0.34%) ⬆️
...ation_tests/subscription_admin_integration_test.cc 96.09% <100.00%> (+0.83%) ⬆️
google/cloud/pubsub/internal/subscriber_auth.cc 100.00% <100.00%> (ø)
google/cloud/pubsub/internal/subscriber_auth.h 100.00% <100.00%> (ø)
...ogle/cloud/pubsub/internal/subscriber_auth_test.cc 100.00% <100.00%> (ø)
google/cloud/pubsub/internal/subscriber_stub.cc 99.06% <100.00%> (+0.01%) ⬆️
...ogle/cloud/pubsub/subscription_admin_connection.cc 84.00% <100.00%> (+2.07%) ⬆️
google/cloud/bigtable/internal/common_client.h 94.02% <0.00%> (-5.98%) ⬇️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1a2ddfb...1222e6f. Read the comment docs.

Copy link
Member

@dbolduc dbolduc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 11 of 11 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @coryan)


google/cloud/pubsub/subscription_admin_connection.cc, line 254 at r1 (raw file):

};

// Decorates a TopicAdminStub. This works for both mock and real stubs.

s/Topic/Subscription/


google/cloud/pubsub/subscription_admin_connection.cc, line 314 at r1 (raw file):

Quoted 9 lines of code…
  auto auth = [&] {
    if (opts.has<google::cloud::UnifiedCredentialsOption>()) {
      return google::cloud::internal::CreateAuthenticationStrategy(
          opts.get<google::cloud::UnifiedCredentialsOption>(), background->cq(),
          opts);
    }
    return google::cloud::internal::CreateAuthenticationStrategy(
        opts.get<google::cloud::GrpcCredentialOption>());
  }();

Note to selves: this logic appears in a lot of places. There is an opportunity to refactor.


google/cloud/pubsub/integration_tests/subscription_admin_integration_test.cc, line 216 at r1 (raw file):

Quoted 7 lines of code…
  if (UsingEmulator()) {
    options = Options{}
                  .set<UnifiedCredentialsOption>(MakeAccessTokenCredentials(
                      "test-only-invalid", std::chrono::system_clock::now() +
                                               std::chrono::minutes(15)))
                  .set<internal::UseInsecureChannelOption>(true);
  }

Does it make sense to move these emulator-only values into here?

auto emulator = internal::GetEnv("PUBSUB_EMULATOR_HOST");
if (emulator.has_value()) {
opts.set<EndpointOption>(*emulator).set<GrpcCredentialOption>(
grpc::InsecureChannelCredentials());
}

It seems weird that we default GrpcCredentialOption but not UnifiedCredentialsOption. (Maybe we shouldn't be setting either in defaults.cc)

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 179db952efcfdd8b0388b4ecb97deaff3aeea36b

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@coryan coryan mentioned this pull request Oct 9, 2021
Copy link
Contributor Author

@coryan coryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 10 of 11 files reviewed, 1 unresolved discussion (waiting on @dbolduc)


google/cloud/pubsub/subscription_admin_connection.cc, line 254 at r1 (raw file):

Previously, dbolduc (Darren Bolduc) wrote…

s/Topic/Subscription/

Fixed.


google/cloud/pubsub/subscription_admin_connection.cc, line 314 at r1 (raw file):

Previously, dbolduc (Darren Bolduc) wrote…
  auto auth = [&] {
    if (opts.has<google::cloud::UnifiedCredentialsOption>()) {
      return google::cloud::internal::CreateAuthenticationStrategy(
          opts.get<google::cloud::UnifiedCredentialsOption>(), background->cq(),
          opts);
    }
    return google::cloud::internal::CreateAuthenticationStrategy(
        opts.get<google::cloud::GrpcCredentialOption>());
  }();

Note to selves: this logic appears in a lot of places. There is an opportunity to refactor.

#7433


google/cloud/pubsub/integration_tests/subscription_admin_integration_test.cc, line 216 at r1 (raw file):

Previously, dbolduc (Darren Bolduc) wrote…
  if (UsingEmulator()) {
    options = Options{}
                  .set<UnifiedCredentialsOption>(MakeAccessTokenCredentials(
                      "test-only-invalid", std::chrono::system_clock::now() +
                                               std::chrono::minutes(15)))
                  .set<internal::UseInsecureChannelOption>(true);
  }

Does it make sense to move these emulator-only values into here?

auto emulator = internal::GetEnv("PUBSUB_EMULATOR_HOST");
if (emulator.has_value()) {
opts.set<EndpointOption>(*emulator).set<GrpcCredentialOption>(
grpc::InsecureChannelCredentials());
}

It seems weird that we default GrpcCredentialOption but not UnifiedCredentialsOption. (Maybe we shouldn't be setting either in defaults.cc)

We probably should switch to setting the unified credentials in this case. #7434

@dbolduc
Copy link
Member

dbolduc commented Oct 9, 2021

We probably should switch to setting the unified credentials in this case. #7434

Ah, yes. That makes more sense.

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 1222e6f2fcea9c17eacf5497ca7741b09d16757d

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@coryan coryan marked this pull request as ready for review October 9, 2021 23:20
@coryan coryan requested a review from a team as a code owner October 9, 2021 23:20
@coryan coryan merged commit e536097 into googleapis:main Oct 9, 2021
@coryan coryan deleted the feat-pubsub-guac-for-subscription-admin branch October 9, 2021 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the Pub/Sub API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants