Skip to content

feat(storage): initial client and integration test #1927

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

Merged
merged 6 commits into from
Apr 28, 2025

Conversation

coryan
Copy link
Collaborator

@coryan coryan commented Apr 25, 2025

Part of the work for #1813

@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Apr 25, 2025
@coryan coryan marked this pull request as ready for review April 25, 2025 19:27
@coryan coryan requested a review from a team as a code owner April 25, 2025 19:27
@coryan
Copy link
Collaborator Author

coryan commented Apr 25, 2025

/cc: @BenWhitehead

@coryan coryan marked this pull request as draft April 25, 2025 19:36
Copy link

codecov bot commented Apr 25, 2025

Codecov Report

Attention: Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.

Project coverage is 95.67%. Comparing base (d8d1a9a) to head (e807b7e).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/storage/src/client.rs 0.00% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1927      +/-   ##
==========================================
- Coverage   96.32%   95.67%   -0.66%     
==========================================
  Files          56       57       +1     
  Lines        2042     2056      +14     
==========================================
  Hits         1967     1967              
- Misses         75       89      +14     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coryan coryan force-pushed the draft-impl-storage-client-scaffold branch from f5e56fe to b7f0d61 Compare April 25, 2025 20:05
@coryan coryan marked this pull request as ready for review April 25, 2025 20:15
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.

Mainly curious about update_bucket

path = "../../src/generated/cloud/secretmanager/v1"
package = "google-cloud-secretmanager-v1"
path = "../../src/generated/cloud/secretmanager/v1"
default-features = false
Copy link
Member

Choose a reason for hiding this comment

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

nit: this crate has no features?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed.

@@ -78,6 +78,17 @@ mod driver {
.map_err(report)
}

#[test_case(storage::client::Storage::builder().with_tracing().with_retry_policy(retry_policy()); "with tracing enabled")]
Copy link
Member

Choose a reason for hiding this comment

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

optional: Add?

    #[test_case(storage::client::Storage::builder(); "default")]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe once the default have retry policies enabled.

I want to minimize the chance of flakes, we know GCS can return errors due to quota / rate limits. Specially for Bucket writes (at most one of those every 2 seconds).

/// For globally unique buckets, `_` may be substituted for the project.
///
/// - Objects are uniquely identified by their name along with the name of the
/// bucket they belong to, as separate strings in this API. For example:
Copy link
Member

Choose a reason for hiding this comment

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

include a sample bucket name after "For example:"

/// ```
/// # use google_cloud_storage::client::Storage;
/// async fn example(client: &Storage) -> gax::Result<()> {
/// let bucket = client.create_bucket("projects/my-project", "my-bucket").send().await?;
Copy link
Member

Choose a reason for hiding this comment

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

Are we concerned about handwritten sample code that doesn't run?

We could maybe use #[doc(include = example.rs) for the sample body, and run the examples in our integration tests.

Also, this is a thing: https://doc.rust-lang.org/stable/rustdoc/scraped-examples.html

(Non-blocking for this PR, but potentially something we want in the long term)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ack. Agree.

@coryan coryan enabled auto-merge (squash) April 28, 2025 14:42
@coryan coryan merged commit 2b2a773 into googleapis:main Apr 28, 2025
21 checks passed
@coryan coryan deleted the draft-impl-storage-client-scaffold branch April 28, 2025 14:57
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
#[derive(Clone, Debug)]
pub struct Storage {
Copy link
Member

Choose a reason for hiding this comment

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

Dare I ask about mocking this client?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You should ask, I have no answer for that yet.

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