From: Pragadeeswaran Sathyanarayanan Date: Tue, 28 Dec 2021 15:26:23 +0000 (+0530) Subject: Improving check_grants reliability X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e60dda8e1deb102872c1dac09b6258f1ccbe27cc;p=s3-tests.git Improving check_grants reliability Signed-off-by: Pragadeeswaran Sathyanarayanan (cherry picked from commit 5f96a32045aa50da674df000f462def06308e10b) --- diff --git a/s3tests_boto3/functional/test_s3.py b/s3tests_boto3/functional/test_s3.py index 3e5dfa16..b9ae380f 100644 --- a/s3tests_boto3/functional/test_s3.py +++ b/s3tests_boto3/functional/test_s3.py @@ -4500,12 +4500,19 @@ def check_access_denied(fn, *args, **kwargs): status = _get_status(e.response) eq(status, 403) + def check_grants(got, want): """ Check that grants list in got matches the dictionaries in want, in any order. """ eq(len(got), len(want)) + + # There are instances when got does not match due the order of item. + if got[0]["Grantee"].get("DisplayName"): + got.sort(key=lambda x: x["Grantee"].get("DisplayName")) + want.sort(key=lambda x: x["DisplayName"]) + for g, w in zip(got, want): w = dict(w) g = dict(g) @@ -4517,6 +4524,7 @@ def check_grants(got, want): eq(g['Grantee'].pop('EmailAddress', None), w['EmailAddress']) eq(g, {'Grantee': {}}) + @attr(resource='bucket') @attr(method='get') @attr(operation='default acl')