Skip to content

Commit

Permalink
Fix: Add regression test for range read retry issue and bump dependen…
Browse files Browse the repository at this point in the history
…cy to fix (#1338)
  • Loading branch information
andrewsg authored Aug 8, 2024
1 parent 5c93503 commit 0323647
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"google-auth >= 2.26.1, < 3.0dev",
"google-api-core >= 2.15.0, <3.0.0dev",
"google-cloud-core >= 2.3.0, < 3.0dev",
"google-resumable-media >= 2.6.0",
"google-resumable-media >= 2.7.2",
"requests >= 2.18.0, < 3.0.0dev",
"google-crc32c >= 1.0, < 2.0dev",
]
Expand Down
13 changes: 13 additions & 0 deletions tests/conformance/test_conformance.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,17 @@ def blob_download_to_filename_chunked(client, _preconditions, **resources):
assert stored_contents == data


def blob_download_to_filename_range(client, _preconditions, **resources):
bucket = resources.get("bucket")
file, data = resources.get("file_data")
blob = client.bucket(bucket.name).blob(file.name)
with tempfile.NamedTemporaryFile() as temp_f:
blob.download_to_filename(temp_f.name, start=1024, end=512 * 1024)
with open(temp_f.name, "r") as file_obj:
stored_contents = file_obj.read()
assert stored_contents == data[1024 : 512 * 1024 + 1]


def client_download_blob_to_file(client, _preconditions, **resources):
bucket = resources.get("bucket")
file, data = resources.get("file_data")
Expand Down Expand Up @@ -748,6 +759,7 @@ def object_acl_clear(client, _preconditions, **resources):
client_download_blob_to_file,
blob_download_to_filename,
blob_download_to_filename_chunked,
blob_download_to_filename_range,
blob_download_as_bytes,
blob_download_as_text,
blobreader_read,
Expand All @@ -756,6 +768,7 @@ def object_acl_clear(client, _preconditions, **resources):
client_download_blob_to_file,
blob_download_to_filename,
blob_download_to_filename_chunked,
blob_download_to_filename_range,
blob_download_as_bytes,
blob_download_as_text,
blobreader_read,
Expand Down

0 comments on commit 0323647

Please sign in to comment.