Skip to content

Commit 84e2f2f

Browse files
rgw: fix stacked delete marker test in test_rgw_versioning
Signed-off-by: Jane Zhu <[email protected]>
1 parent 3b9ba90 commit 84e2f2f

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

qa/workunits/rgw/test_rgw_versioning.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,21 @@ def main():
5858
assert 'DeleteMarker' in resp, 'DeleteMarker key not present in response'
5959
assert resp['DeleteMarker'], 'DeleteMarker value not True in response'
6060
assert 'VersionId' in resp, 'VersionId key not present in response'
61-
version_id = resp['VersionId']
62-
bucket.Object(key).delete()
63-
connection.ObjectVersion(bucket.name, key, version_id).delete()
61+
version_id_1 = resp['VersionId']
62+
63+
resp = bucket.Object(key).delete()
64+
assert 'DeleteMarker' in resp, 'DeleteMarker key not present in response'
65+
assert resp['DeleteMarker'], 'DeleteMarker value not True in response'
66+
assert 'VersionId' in resp, 'VersionId key not present in response'
67+
version_id_2 = resp['VersionId']
68+
69+
connection.ObjectVersion(bucket.name, key, version_id_2).delete()
70+
# bucket index should only include entries for an object version
71+
out = exec_cmd(f'radosgw-admin bi list --bucket {BUCKET_NAME}')
72+
json_out = json.loads(out.replace(b'\x80', b'0x80'))
73+
assert len(json_out) == 4, 'bucket index did not only include entries for an object version'
74+
75+
connection.ObjectVersion(bucket.name, key, version_id_1).delete()
6476
# bucket index should now be empty
6577
out = exec_cmd(f'radosgw-admin bi list --bucket {BUCKET_NAME}')
6678
json_out = json.loads(out.replace(b'\x80', b'0x80'))

0 commit comments

Comments
 (0)