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(storage): offer mock client without decorators #11697

Merged
merged 2 commits into from
May 23, 2023

Conversation

dbolduc
Copy link
Member

@dbolduc dbolduc commented May 22, 2023

Motivated by #11613

This allows customers to mock a single response from a RawClient (instead of N responses in the case of transient errors).

Prefer the UndecoratedClientFromMock > ClientFromMock in the public samples. I did not update our unit tests.

I did not think about whether extra effort is needed to make the install work.


This change is Reviewable

@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label May 22, 2023
@codecov
Copy link

codecov bot commented May 22, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (b4f17b6) 83.03% compared to head (0eb2ba7) 83.03%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #11697   +/-   ##
=======================================
  Coverage   83.03%   83.03%           
=======================================
  Files        1826     1827    +1     
  Lines      164702   164704    +2     
=======================================
+ Hits       136758   136762    +4     
+ Misses      27944    27942    -2     
Impacted Files Coverage Δ
google/cloud/storage/testing/mock_client.h 100.00% <ø> (ø)
...ud/storage/examples/storage_client_mock_samples.cc 100.00% <100.00%> (ø)
google/cloud/storage/testing/mock_client.cc 100.00% <100.00%> (ø)
...cloud/storage/testing/remove_stale_buckets_test.cc 100.00% <100.00%> (ø)

... and 8 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@dbolduc dbolduc marked this pull request as ready for review May 22, 2023 22:30
@dbolduc dbolduc requested a review from a team as a code owner May 22, 2023 22:30
* Create a client configured to use the given mock.
*
* Unless you specifically need to mock the behavior of retries, prefer
* #google::cloud::storage::testing::UndecoratedClientFromMock
Copy link
Contributor

Choose a reason for hiding this comment

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

Typically if you say UndecoratedClientFromMock() (note the parenthesis) Doxygen will automatically link the function.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed, thanks.

@dbolduc dbolduc force-pushed the storage-undecorated-mock-client branch from 15db816 to 0eb2ba7 Compare May 23, 2023 04:13
@dbolduc dbolduc merged commit 6ffe40c into googleapis:main May 23, 2023
@dbolduc dbolduc deleted the storage-undecorated-mock-client branch May 23, 2023 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants