Skip to content

test(gax): add tests for bidi_stream and bidi_stream_with_status - #6313

Draft
joshuatants wants to merge 1 commit into
googleapis:grpc_rustfrom
joshuatants:grpc_rust_invoker_cleanup
Draft

test(gax): add tests for bidi_stream and bidi_stream_with_status#6313
joshuatants wants to merge 1 commit into
googleapis:grpc_rustfrom
joshuatants:grpc_rust_invoker_cleanup

Conversation

@joshuatants

Copy link
Copy Markdown
Contributor

For #5991.

Also remove previous test-only helper function invoker.

@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 refactors the gRPC Rust client integration tests to use the newly implemented bidi_stream and bidi_stream_with_status APIs instead of the temporary invoker helper, which has been removed. It adds comprehensive test coverage for bidirectional streaming, including happy paths, cancellation, stream dropping, mid-stream server errors, and initial connection errors. There are no review comments to address, and I have no feedback to provide.

@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.27%. Comparing base (d44ebaf) to head (6549f01).

Additional details and impacted files
@@              Coverage Diff              @@
##           grpc_rust    #6313      +/-   ##
=============================================
+ Coverage      96.23%   96.27%   +0.04%     
=============================================
  Files            286      286              
  Lines          74036    74072      +36     
=============================================
+ Hits           71250    71315      +65     
+ Misses          2786     2757      -29     

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

For googleapis#5991.

Also remove previous test-only helper function `invoker`.
@joshuatants
joshuatants force-pushed the grpc_rust_invoker_cleanup branch from ace1533 to 6549f01 Compare August 10, 2026 06:39
tx,
mut stream,
metadata,
..

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.

In Rust, when we destructure a struct like this, the unmentioned fields (e.g. _server_task, _client) will be dropped, right? So these tasks might continue running in the background, and any panic or failure in the background will be silently ignored.

}

#[tokio::test]
async fn bidi_call_yields_error_on_server_error_status() -> anyhow::Result<()> {

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.

Quick check of my understanding:
IIUC in this test case, the error is only observed when stream.message().await is called.

So this doesn't test the immediate error check in invoke_bidi on line 214.

Do you want to test the case where invoke_bidi returns an error immediately?

})
}

// TODO(#5991): Add integration tests for `GrpcRustClient::bidi_stream` and `GrpcRustClient::bidi_stream_with_status` (covering happy paths and request stream failures).

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.

I think the unit test cases do not cover the case of request stream failure? Do we need to test this case?

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.

2 participants