mirror of
https://github.com/ceph/s3-tests.git
synced 2025-02-19 15:23:36 +00:00
HeadBucket: add read-stats query string for usage test
Refs: https://github.com/ceph/ceph/pull/56756
Signed-off-by: Seena Fallah <seenafallah@gmail.com>
(cherry picked from commit 3145b1b0c3
)
This commit is contained in:
parent
d23cb37d70
commit
f723879d10
1 changed files with 9 additions and 2 deletions
|
@ -1098,10 +1098,13 @@ def test_account_usage():
|
|||
@pytest.mark.fails_on_aws
|
||||
@pytest.mark.fails_on_dbstore
|
||||
def test_head_bucket_usage():
|
||||
# boto3.set_stream_logger(name='botocore')
|
||||
client = get_client()
|
||||
bucket_name = _create_objects(keys=['foo'])
|
||||
# adds the unordered query parameter
|
||||
|
||||
def add_read_stats_param(request, **kwargs):
|
||||
request.params['read-stats'] = 'true'
|
||||
|
||||
client.meta.events.register('request-created.s3.HeadBucket', add_read_stats_param)
|
||||
client.meta.events.register('after-call.s3.HeadBucket', get_http_response)
|
||||
client.head_bucket(Bucket=bucket_name)
|
||||
hdrs = http_response['headers']
|
||||
|
@ -3322,6 +3325,10 @@ def test_bucket_head_extended():
|
|||
bucket_name = get_new_bucket()
|
||||
client = get_client()
|
||||
|
||||
def add_read_stats_param(request, **kwargs):
|
||||
request.params['read-stats'] = 'true'
|
||||
client.meta.events.register('request-created.s3.HeadBucket', add_read_stats_param)
|
||||
|
||||
response = client.head_bucket(Bucket=bucket_name)
|
||||
assert int(response['ResponseMetadata']['HTTPHeaders']['x-rgw-object-count']) == 0
|
||||
assert int(response['ResponseMetadata']['HTTPHeaders']['x-rgw-bytes-used']) == 0
|
||||
|
|
Loading…
Add table
Reference in a new issue