diff options
author | Jane Zhu <jzhu116@bloomberg.net> | 2023-05-02 01:09:18 +0200 |
---|---|---|
committer | Juan Zhu <jzhu4@dev-10-34-20-139.pw1.bcc.bloomberg.com> | 2023-05-03 18:55:23 +0200 |
commit | 4ca7643bf623b4dd18e112956af36fcb0c86d30a (patch) | |
tree | b9371755cac0fc03c160afb2dd7938f7f36f2fc2 /src/test/rgw/bucket_notification | |
parent | Merge pull request #51299 from zdover23/wip-doc-2023-05-02-radosgw-notificati... (diff) | |
download | ceph-4ca7643bf623b4dd18e112956af36fcb0c86d30a.tar.xz ceph-4ca7643bf623b4dd18e112956af36fcb0c86d30a.zip |
rgw/notification: remove non x-amz-meta-* attributes from the metadata section of the regular notifications
Signed-off-by: Juan Zhu <jzhu4@dev-10-34-20-139.pw1.bcc.bloomberg.com>
Diffstat (limited to 'src/test/rgw/bucket_notification')
-rw-r--r-- | src/test/rgw/bucket_notification/test_bn.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/test/rgw/bucket_notification/test_bn.py b/src/test/rgw/bucket_notification/test_bn.py index 66ee673cbed..7e94379c79b 100644 --- a/src/test/rgw/bucket_notification/test_bn.py +++ b/src/test/rgw/bucket_notification/test_bn.py @@ -345,6 +345,8 @@ def verify_events_by_elements(events, keys, exact_match=False, deletions=False): log.error(events) assert False, err +META_PREFIX = 'x-amz-meta-' + def verify_s3_records_by_elements(records, keys, exact_match=False, deletions=False, expected_sizes={}, etags=[]): """ verify there is at least one record per element """ err = '' @@ -363,6 +365,9 @@ def verify_s3_records_by_elements(records, keys, exact_match=False, deletions=Fa #assert_equal(key.etag[1:-1], record['s3']['object']['eTag']) if etags: assert_in(key.etag[1:-1], etags) + if len(record['s3']['object']['metadata']) > 0: + for meta in record['s3']['object']['metadata']: + assert(meta['key'].startswith(META_PREFIX)) if deletions and record['eventName'].startswith('ObjectRemoved'): key_found = True object_size = record['s3']['object']['size'] @@ -379,6 +384,9 @@ def verify_s3_records_by_elements(records, keys, exact_match=False, deletions=Fa assert_equal(key.etag, record['s3']['object']['eTag']) if etags: assert_in(key.etag[1:-1], etags) + if len(record['s3']['object']['metadata']) > 0: + for meta in record['s3']['object']['metadata']: + assert(meta['key'].startswith(META_PREFIX)) if deletions and record['eventName'].startswith('ObjectRemoved'): key_found = True object_size = record['s3']['object']['size'] @@ -2345,8 +2353,6 @@ def test_ps_s3_multipart_on_master(): # delete the bucket conn.delete_bucket(bucket_name) -META_PREFIX = 'x-amz-meta-' - @attr('amqp_test') def test_ps_s3_metadata_filter_on_master(): """ test s3 notification of metadata on master """ @@ -2478,7 +2484,7 @@ def test_ps_s3_metadata_on_master(): notification_name = bucket_name + NOTIFICATION_SUFFIX meta_key = 'meta1' meta_value = 'This is my metadata value' - meta_prefix = 'x-amz-meta-' + meta_prefix = META_PREFIX topic_conf_list = [{'Id': notification_name, 'TopicArn': topic_arn, 'Events': ['s3:ObjectCreated:*', 's3:ObjectRemoved:*'], }] |