test(showcase): add showcase streaming integration test DO NOT REVIEW - #6191
test(showcase): add showcase streaming integration test DO NOT REVIEW#6191suzmue wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces bidirectional streaming support for the Messaging service in the showcase crate, gated under the google_cloud_unstable_gapic_streaming feature flag. It adds the generated protobuf code, conversion traits, client and transport implementations for the connect method, and integration tests. Feedback on the integration test suggests asserting that a response is received from the stream using .expect() rather than silently passing on an empty stream.
| if let Some(res) = receiver.recv().await { | ||
| let response = res?; | ||
| println!( | ||
| "Successfully received bidi streaming response: {:?}", | ||
| response | ||
| ); | ||
| } |
There was a problem hiding this comment.
Using if let Some(res) = ... here means the test will silently pass if the stream is closed immediately and no response is ever received. To make the test robust and ensure we actually verify the received response, we should assert that we got Some response using .expect() as preferred by the Repository Style Guide for tests.
let res = receiver.recv().await.expect("expected a response from the bidi stream");
let response = res?;
println!(
"Successfully received bidi streaming response: {:?}",
response
);References
- In tests, prefer
?. If that is not possible use.expect(). Only use.unwrap()as a last resort. (link)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6191 +/- ##
=======================================
Coverage 96.59% 96.59%
=======================================
Files 266 266
Lines 66852 66852
=======================================
Hits 64574 64574
Misses 2278 2278 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Do not merge, this is to demo that the new code works.
This PR is based on googleapis/librarian#7071 with googleapis/librarian#7078