Skip to content

Comments

feat: Triger bidi conformance tests#1757

Draft
chandra-siri wants to merge 3 commits intopass_routing_token_correctlyfrom
triger_bidi_conformance_tests
Draft

feat: Triger bidi conformance tests#1757
chandra-siri wants to merge 3 commits intopass_routing_token_correctlyfrom
triger_bidi_conformance_tests

Conversation

@chandra-siri
Copy link
Collaborator

feat: Triger bidi conformance tests

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: storage Issues related to the googleapis/python-storage API. labels Feb 20, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @chandra-siri, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the infrastructure for running bidirectional conformance tests against a gRPC testbench. It introduces a more flexible gRPC client setup for testing, adds a utility to manage the testbench server lifecycle, and refactors existing conformance tests to leverage these enhancements and integrate with the pytest framework. These changes streamline the process of validating the client's behavior under various network conditions and fault injection scenarios.

Highlights

  • Enhanced gRPC Client for Testing: The AsyncGrpcClient has been updated to include a create_insecure_channel option, allowing for easier testing against local testbench environments by creating anonymous, insecure gRPC channels.
  • New Conformance Test Utilities: A new utility file, _utils.py, was added to provide a helper function (start_grpc_server) for reliably starting the testbench gRPC server before conformance tests execute.
  • Refactored Bidirectional Conformance Tests: The test_bidi_reads.py and test_bidi_writes.py conformance tests have been refactored to use the new AsyncGrpcClient for testbench interactions and integrated with pytest for better test management. Some test scenarios related to 'Smarter Resumption' were temporarily commented out.
  • Metadata Formatting Correction: The x-goog-request-params metadata in both read and write object streams was corrected to use an ampersand (&) as a separator instead of a comma (,), aligning with expected format.
Changelog
  • google/cloud/storage/asyncio/async_appendable_object_writer.py
    • Updated metadata variable name from metadata to current_metadata when opening the write object stream.
  • google/cloud/storage/asyncio/async_grpc_client.py
    • Added grpc and google.auth.credentials imports.
    • Introduced create_insecure_channel parameter to the __init__ method to enable insecure channel creation for testing.
    • Implemented _create_anonymous_client and _create_insecure_grpc_client methods to handle the creation of insecure gRPC clients.
  • google/cloud/storage/asyncio/async_read_object_stream.py
    • Changed the separator for x-goog-request-params metadata from a comma (,) to an ampersand (&).
  • google/cloud/storage/asyncio/async_write_object_stream.py
    • Changed the separator for x-goog-request-params metadata from a comma (,) to an ampersand (&).
  • tests/conformance/_utils.py
    • Added a new file containing the start_grpc_server utility function to ensure the testbench gRPC server is running.
  • tests/conformance/test_bidi_reads.py
    • Imported client_options, AsyncGrpcClient, pytest, and start_grpc_server.
    • Modified run_test_scenario to instantiate AsyncGrpcClient with create_insecure_channel=True and pass it to AsyncMultiRangeDownloader.create_mrd.
    • Converted the main function to a pytest test function named test_bidi_reads and added a call to start_grpc_server.
    • Commented out one test scenario related to 'Smarter Resumption: Retry 503 after partial data'.
    • Removed the if __name__ == '__main__': block.
  • tests/conformance/test_bidi_writes.py
    • Removed asyncio import and added pytest, client_options, AsyncGrpcClient, and start_grpc_server imports.
    • Modified run_test_scenario to instantiate AsyncGrpcClient with create_insecure_channel=True and pass it to AsyncAppendableObjectWriter.
    • Converted the main function to a pytest test function named test_bidi_writes and added a call to start_grpc_server.
    • Commented out two test scenarios related to 'Smarter Resumption: Retry 503 after partial data'.
    • Removed the if __name__ == '__main__': block.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

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

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 enhances test coverage by introducing conformance tests for bidirectional reads and writes, and refactors the AsyncGrpcClient. It also addresses minor metadata handling issues in async_read_object_stream.py and async_write_object_stream.py. A medium-severity vulnerability was identified concerning the create_insecure_channel feature, which, despite being for testing, could lead to unencrypted data transmission in production if misused. It is recommended to implement safeguards, such as an environment variable guard, to prevent this. The addition of _utils.py further supports these conformance tests.

@chandra-siri chandra-siri changed the base branch from main to pass_routing_token_correctly February 20, 2026 17:33
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 googleapis/python-storage API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant