Skip to content

test_s3: fix test_bucket_logging_request_id for newer botocore#751

Open
cheese-cakee wants to merge 1 commit into
ceph:ceph-masterfrom
cheese-cakee:fix-76587-logging-request-id
Open

test_s3: fix test_bucket_logging_request_id for newer botocore#751
cheese-cakee wants to merge 1 commit into
ceph:ceph-masterfrom
cheese-cakee:fix-76587-logging-request-id

Conversation

@cheese-cakee
Copy link
Copy Markdown
Contributor

The test test_bucket_logging_request_id (introduced in #729) registers
a boto3 after-call.s3.PutObject event handler that incorrectly accesses
kwargs["response"]. Botocore does not pass a response kwarg in
after-call events; the correct kwargs are parsed, http_response,
model, and context.

This causes the test to fail in teuthology with:

KeyError: "response"
s3tests/functional/test_s3.py:15754: KeyError

Fix by reading the x-amz-request-id header directly from the
put_object() response, which is simpler and works across all botocore
versions.

Fixes: http://tracker.ceph.com/issues/76587
Related: #729

@cheese-cakee
Copy link
Copy Markdown
Contributor Author

@yuvalif please review when possible. This fixes the teuthology failure reported by @ivancich in #729 (tracker #76587).

The test was using a boto3 event handler to capture the x-amz-request-id
header, incorrectly accessing kwargs["response"] in an after-call event.
Botocore's after-call event does not pass a "response" kwarg; it passes
"parsed", "http_response", "model", and "context". Fix by reading the
request ID directly from the put_object() response, which is simpler and
works across all botocore versions.

Fixes: https://tracker.ceph.com/issues/76587
Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant