]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
Fix wrong assertion of the test: `test_buckets_list_ctime` 565/head
authorSumedh A. Kulkarni <sumedh.a.kulkarni@seagate.com>
Tue, 5 Apr 2022 10:25:00 +0000 (04:25 -0600)
committerBob Ham <bham12@bloomberg.net>
Tue, 14 May 2024 11:12:17 +0000 (07:12 -0400)
TestName:
s3tests_boto3.functional.test_s3:test_buckets_list_ctime

Problem:
The test creates 5 buckets for a user but in an assertion check,
it asserts false if any bucket of the user has CreationTime less
than a day prior to current time.
Due to this reason the test fails if the user has pre-existing
buckets older than a day.

Solution:
Assert only on the CreationTime of buckets that were created with
test execution.

Signed-off-by: Sumedh A. Kulkarni <sumedh.a.kulkarni@seagate.com>
Co-developed-by: Bob Ham <bham12@bloomberg.net>
Signed-off-by: Bob Ham <bham12@bloomberg.net>
s3tests_boto3/functional/test_s3.py

index 728f97b6a214a27e983834ba3bb143dbc8780c40..47cc52558d277b8b595c0c4a70e1d3d26eb8b7c4 100644 (file)
@@ -5266,13 +5266,17 @@ def test_buckets_list_ctime():
     before = datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta(days=1)
 
     client = get_client()
+    buckets = []
     for i in range(5):
-        client.create_bucket(Bucket=get_new_bucket_name())
+        name = get_new_bucket_name()
+        client.create_bucket(Bucket=name)
+        buckets.append(name)
 
     response = client.list_buckets()
     for bucket in response['Buckets']:
-        ctime = bucket['CreationDate']
-        assert before <= ctime, '%r > %r' % (before, ctime)
+        if bucket['Name'] in buckets:
+            ctime = bucket['CreationDate']
+            assert before <= ctime, '%r > %r' % (before, ctime)
 
 @pytest.mark.fails_on_aws
 def test_list_buckets_anonymous():