Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support error code for single shot upload #698

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
280 changes: 280 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions testbench/rest_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,22 @@ def object_insert(bucket_name):
blob, projection = gcs_type.object.Object.init_media(flask.request, bucket)
elif upload_type == "multipart":
blob, projection = gcs_type.object.Object.init_multipart(flask.request, bucket)
testbench.common.extract_instruction(request, context=None)
(
error_code,
after_bytes,
test_id,
) = testbench.common.get_retry_uploads_error_after_bytes(db, request)
if error_code and len(blob.media) >= after_bytes:
if test_id:
db.dequeue_next_instruction(test_id, "storage.objects.insert")
testbench.error.generic(
"Fault injected during a resumable upload",
rest_code=error_code,
grpc_code=None,
context=None,
)

# Handle stall for full uploads.
testbench.common.extract_instruction(request, context=None)
(
Expand Down
Loading
Loading