Skip to content

test(storage): update test_mrd_open_with_read_handle_over_cloud_path for CloudPath read_handle support - #19051

Draft
shradhakatyal wants to merge 1 commit into
googleapis:mainfrom
shradhakatyal:test/gcs-rapid-read-handle-cloud-path
Draft

shradhakatyal wants to merge 1 commit into
googleapis:mainfrom
shradhakatyal:test/gcs-rapid-read-handle-cloud-path

Conversation

@shradhakatyal

Copy link
Copy Markdown
Contributor

Summary

Updates test_mrd_open_with_read_handle_over_cloud_path in packages/google-cloud-storage/tests/system/test_rapid.py to assert assert new_mrd.persisted_size is None (matching test_mrd_open_with_read_handle over DirectPath).

Why This Is Needed

  1. How persisted_size Is Populated:
    In _AsyncReadObjectStream.open() (packages/google-cloud-storage/google/cloud/storage/asyncio/async_read_object_stream.py), self.persisted_size = response.metadata.size is only populated when the server returns response.metadata (Object proto) in the initial BidiReadObjectResponse.
  2. Behavior When Opening with read_handle:
    When a BidiReadObject stream is opened using an existing read_handle (BidiReadObjectSpec.read_handle), the server fast-path skips metadata lookup and omits response.metadata from the initial response. Consequently, new_mrd.persisted_size remains None (as verified in test_mrd_open_with_read_handle over DirectPath).
  3. GCS Backend Support for read_handle over CloudPath:
    Previously, test_mrd_open_with_read_handle_over_cloud_path asserted assert new_mrd.persisted_size == len(_BYTES_TO_UPLOAD) because the GCS backend did not support read_handle over CLOUD_PATH (attempt_direct_path=False), falling back to a full open that returned response.metadata.
    The GCS backend now honors read_handle over CLOUD_PATH just like DIRECT_PATH, omitting response.metadata on initial open so new_mrd.persisted_size is None.
await new_mrd.open()
# persisted_size not set when opened with read_handle
assert new_mrd.persisted_size is None

[Generated-by: AI]

…for CloudPath read_handle support

When opening an AsyncMultiRangeDownloader with an existing read_handle over
CLOUD_PATH (attempt_direct_path=False), the GCS backend now honors the
read_handle fast-path just as it does over DIRECT_PATH, omitting object
metadata in the initial BidiReadObjectResponse and leaving persisted_size as
None.

[Generated-by: AI]

@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 updates a system test in test_rapid.py to assert that persisted_size is None instead of the uploaded bytes length when opened with a read_handle. I have no feedback to provide as there are no review comments.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant