Visitar URL original
test(storage): add fake-server bidi read conformance tests by xlai20 · Pull Request #7149 · googleapis/google-cloud-rust · GitHub
Skip to content

test(storage): add fake-server bidi read conformance tests - #7149

Open
xlai20 wants to merge 6 commits into
googleapis:mainfrom
xlai20:rapid_cache_ultra_bidi_read_remaining
Open

xlai20 wants to merge 6 commits into
googleapis:mainfrom
xlai20:rapid_cache_ultra_bidi_read_remaining

Conversation

@xlai20

@xlai20 xlai20 commented Oct 8, 2026

Copy link
Copy Markdown
Member

Description

This PR introduces 10 end-to-end fake-server integration tests for bidirectional streaming reads (open_object / bidi_read_object) in src/storage/tests/open_object_grpc.rs.

All new tests are encapsulated in a self-contained conformance submodule at the bottom of open_object_grpc.rs to avoid polluting existing tests and helpers.


Test Cases Added

  • handle_redirect_error: Verifies handling of mid-read BidiReadObjectRedirectedError gRPC responses, ensuring the client transparently reconnects using the redirected read_handle and routing_token with adjusted read offsets.
  • handle_redirect_error_on_open: Verifies handling of BidiReadObjectRedirectedError during initial session open, reconnecting with the updated routing token and completing session initialization.
  • handle_redirect_error_max_attempts: Verifies redirect limit enforcement when the server repeatedly returns redirects, confirming the client stops retrying once the attempt budget is exhausted.
  • retry_settings_max_attempt: Verifies attempt budget limits under retry settings, confirming that repeated mid-stream failures exhaust resume attempts and fail the reader.
  • request_option_verification: Verifies propagation of user project, preconditions (if_generation_match, etc.), and Customer-Supplied Encryption Keys (CSEK AES-256) into gRPC request headers and protobuf fields.
  • failed_stream_restart_should_fail_all_pending_reads: Verifies that if an underlying stream breaks and cannot restart (NeverResume), all active and subsequent reads fail immediately.
  • retryable_error_while_open: Verifies that opening an object session retries automatically when the initial open encounters a transient error (e.g. Unavailable).
  • on_complete_without_data: Verifies handling when the server completes a range (range_end: true) without delivering expected data bytes, ensuring the short read returns an error.
  • fast_open_read_session: Verifies fast open by bundling read ranges along with the initial ReadObjectSpec request message.
  • non_retryable_error: Verifies non-retryable error classification, confirming permanent errors (NotFound) fail immediately on the first attempt without retrying.

Verification

All tests compile cleanly, adhere to crate formatting, and pass with zero warnings:

cargo fmt -p google-cloud-storage
cargo clippy -p google-cloud-storage --profile test -- -D warnings
cargo test -p google-cloud-storage --test open_object_grpc conformance

@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Oct 8, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a comprehensive suite of conformance tests in src/storage/tests/open_object_grpc.rs to verify the gRPC client's behavior under various scenarios, such as redirect handling, retry limits, request option propagation, stream failures, and fast open sessions. The review feedback highlights several optimization opportunities aligned with the repository style guide, including avoiding unnecessary clones of read_ranges, replacing Arc<Mutex<Option<oneshot::Sender>>> with cloneable mpsc channels to eliminate unnecessary locks, and using .expect_err() instead of .unwrap() in tests for idiomatic error handling.

Comment thread src/storage/tests/open_object_grpc.rs Outdated
Comment thread src/storage/tests/open_object_grpc.rs Outdated
Comment thread src/storage/tests/open_object_grpc.rs Outdated
Comment thread src/storage/tests/open_object_grpc.rs Outdated
Comment thread src/storage/tests/open_object_grpc.rs Outdated
Comment thread src/storage/tests/open_object_grpc.rs Outdated
@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.33%. Comparing base (e351994) to head (41bbeec).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7149   +/-   ##
=======================================
  Coverage   97.32%   97.33%           
=======================================
  Files         327      327           
  Lines      127647   127647           
=======================================
+ Hits       124236   124244    +8     
+ Misses       3411     3403    -8     

☔ View full report in Codecov by Harness.
📢 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.

@xlai20
xlai20 marked this pull request as ready for review October 8, 2026 08:29
@xlai20
xlai20 requested review from a team as code owners October 8, 2026 08:29

This branch has not been deployed

No deployments
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.

1 participant