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

refactor(storage): make some code more testable #14429

Conversation

coryan
Copy link
Contributor

@coryan coryan commented Jul 3, 2024

This just changes storage::internal::RetryObjectReadSource to make the
class more testable. The backoff function is provided as an argument, so
it can be mocked. Likewise, the code to start new downloads is provided
by a factory function.

Incidentally, I captured the current options using
internal::ImmutableOptions, saving a number of copies in the process.

Part of the work for #14424


This change is Reviewable

This just changes `storage::internal::RetryObjectReadSource` to make the
class more testable. The backoff function is provided as an argument, so
it can be mocked. Likewise, the code to start new downloads is provided
by a factory function.

Incidentally, I captured the current options using
`internal::ImmutableOptions`, saving a number of copies in the process.
@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Jul 3, 2024
Copy link

codecov bot commented Jul 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.58%. Comparing base (b5026cc) to head (5e5f7e6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14429      +/-   ##
==========================================
- Coverage   93.58%   93.58%   -0.01%     
==========================================
  Files        2313     2313              
  Lines      206884   206894      +10     
==========================================
+ Hits       193615   193619       +4     
- Misses      13269    13275       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@coryan coryan marked this pull request as ready for review July 3, 2024 12:22
@coryan coryan requested review from a team as code owners July 3, 2024 12:22
@coryan coryan enabled auto-merge (squash) July 3, 2024 17:35
@coryan coryan merged commit b2bf3cb into googleapis:main Jul 3, 2024
63 checks passed
@coryan coryan deleted the refactor-storage-make-retryobjectreadsource-testable branch July 3, 2024 18:15
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