From: Matt Benjamin Date: Tue, 5 Oct 2021 12:17:59 +0000 (-0400) Subject: qa/rgw: fix ops log tests to handle non-bucket ops (which are now valid) X-Git-Tag: v17.1.0~740^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F43442%2Fhead;p=ceph.git qa/rgw: fix ops log tests to handle non-bucket ops (which are now valid) After 3863eb89512f1698b8e56f1f1ffc78a6ca8d5826--rgw: permit logging of list-bucket (and any other no-bucket op-- the radosgw ops-log contains entries for ops with no associated buckets--e.g., list_buckets. When examining such a log object in the radosgw_admin task, don't assert that it has any bucket name. Fixes: https://tracker.ceph.com/issues/52647 Signed-off-by: Matt Benjamin --- diff --git a/qa/tasks/radosgw_admin.py b/qa/tasks/radosgw_admin.py index 836736f1a577..e803249cff12 100644 --- a/qa/tasks/radosgw_admin.py +++ b/qa/tasks/radosgw_admin.py @@ -697,17 +697,21 @@ def task(ctx, config): check_status=True) assert len(rgwlog) > 0 - # exempt bucket_name2 from checking as it was only used for multi-region tests - assert rgwlog['bucket'].find(bucket_name) == 0 or rgwlog['bucket'].find(bucket_name2) == 0 - assert rgwlog['bucket'] != bucket_name or rgwlog['bucket_id'] == bucket_id - assert rgwlog['bucket_owner'] == user1 or rgwlog['bucket'] == bucket_name + '5' or rgwlog['bucket'] == bucket_name2 - for entry in rgwlog['log_entries']: - log.debug('checking log entry: ', entry) - assert entry['bucket'] == rgwlog['bucket'] - possible_buckets = [bucket_name + '5', bucket_name2] - user = entry['user'] - assert user == user1 or user.endswith('system-user') or \ - rgwlog['bucket'] in possible_buckets + # skip any entry for which there is no bucket name--e.g., list_buckets, + # since that is valid but cannot pass the following checks + entry_bucket_name = rgwlog['bucket'] + if entry_bucket_name.strip() != "": + # exempt bucket_name2 from checking as it was only used for multi-region tests + assert rgwlog['bucket'].find(bucket_name) == 0 or rgwlog['bucket'].find(bucket_name2) == 0 + assert rgwlog['bucket'] != bucket_name or rgwlog['bucket_id'] == bucket_id + assert rgwlog['bucket_owner'] == user1 or rgwlog['bucket'] == bucket_name + '5' or rgwlog['bucket'] == bucket_name2 + for entry in rgwlog['log_entries']: + log.debug('checking log entry: ', entry) + assert entry['bucket'] == rgwlog['bucket'] + possible_buckets = [bucket_name + '5', bucket_name2] + user = entry['user'] + assert user == user1 or user.endswith('system-user') or \ + rgwlog['bucket'] in possible_buckets # TESTCASE 'log-rm','log','rm','delete log objects','succeeds' (err, out) = rgwadmin(ctx, client, ['log', 'rm', '--object', obj],