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(generator): connection respects per call policies #8013

Merged
merged 4 commits into from
Jan 19, 2022

Conversation

dbolduc
Copy link
Member

@dbolduc dbolduc commented Jan 19, 2022

Fixes #8002

First commit has the logic changes in generator/
Second commit has the changes to the golden files
Third commit has the changes to generated libraries in google/cloud/...

I decided to use if blocks instead of predicates, per this discussion.

We have the following types of calls:

  1. Sync Loops - (R, B, I)
  2. LRO Polling Loops - (R, B, I, P)
  3. Paginated (StreamRange) - (R, B, I)
  4. Streaming Reads (StreamRange) - (R, B)
  5. Async Loop - (R, B, I)

Letters in parentheses are the policies used in such a call.
R = Retry, B = Backoff, I = Idempotency, P = Polling.

The bold letters are the ones I actually tested for. I did not feel like writing any other tests. I would begrudgingly add more tests, if asked nicely.


This change is Reviewable

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: a05762acc17025a835076eb47fb803b454d4f9bc

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

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: c52612d4aa0d769bf963bcc7ec73d2aa8455e99d

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

@codecov
Copy link

codecov bot commented Jan 19, 2022

Codecov Report

Merging #8013 (bbc35f8) into main (1927dd7) will decrease coverage by 0.00%.
The diff coverage is 92.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8013      +/-   ##
==========================================
- Coverage   95.09%   95.09%   -0.01%     
==========================================
  Files        1307     1308       +1     
  Lines      117472   117569      +97     
==========================================
+ Hits       111715   111805      +90     
- Misses       5757     5764       +7     
Impacted Files Coverage Δ
...ion_tests/golden/golden_kitchen_sink_connection.cc 73.68% <83.87%> (+0.80%) ⬆️
...or/integration_tests/golden/tests/plumbing_test.cc 93.33% <93.33%> (ø)
...tion_tests/golden/golden_thing_admin_connection.cc 77.87% <95.65%> (+1.42%) ⬆️
generator/internal/connection_generator.cc 100.00% <100.00%> (ø)
...cloud/pubsub/internal/subscription_session_test.cc 97.75% <0.00%> (-0.25%) ⬇️
google/cloud/pubsub/samples/samples.cc 92.02% <0.00%> (-0.08%) ⬇️
...integration_tests/schema_admin_integration_test.cc 100.00% <0.00%> (+1.08%) ⬆️
google/cloud/bigtable/internal/common_client.cc 97.14% <0.00%> (+1.42%) ⬆️

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 1927dd7...bbc35f8. Read the comment docs.

Copy link
Contributor

@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.

There are a couple of PRs in flight that you may need to coordinate with.

auto clone = absl::make_unique<MockRetryPolicy>();
// We will just say the policy is never exhausted, and use a permanent error
// to break out of the loop.
EXPECT_CALL(*clone, IsExhausted).WillRepeatedly(Return(false));
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider .Times(AtLeast(1)).WillRepeatedly(Return(false)); ?

Copy link
Member Author

Choose a reason for hiding this comment

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

sure

@dbolduc dbolduc marked this pull request as ready for review January 19, 2022 14:03
@dbolduc dbolduc requested a review from a team as a code owner January 19, 2022 14:03
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: bbc35f80a3bdc8edde9b51836fb022d11845eda6

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

@dbolduc dbolduc enabled auto-merge (squash) January 19, 2022 14:06
@dbolduc dbolduc merged commit bc7f1c5 into googleapis:main Jan 19, 2022
@dbolduc dbolduc deleted the generator-per-call-policies branch January 19, 2022 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generator accepts per-call retry/backoff/polling policies
3 participants