]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
test that listed buckets have creation time 386/head
authorCasey Bodley <cbodley@redhat.com>
Thu, 11 Mar 2021 21:36:24 +0000 (16:36 -0500)
committerCasey Bodley <cbodley@redhat.com>
Thu, 11 Mar 2021 21:48:04 +0000 (16:48 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
s3tests_boto3/functional/test_s3.py

index 00fd0be86192a00fea6430a5fd262dd8dea6c277..16a97dc2175de2aaf6f40fb424632fa101fbc5e0 100644 (file)
@@ -6073,6 +6073,23 @@ def test_buckets_create_then_list():
         if name not in buckets_list:
             raise RuntimeError("S3 implementation's GET on Service did not return bucket we created: %r", bucket.name)
 
+@attr(resource='bucket')
+@attr(method='get')
+@attr(operation='list all buckets')
+@attr(assertion='all buckets have a sane creation time')
+def test_buckets_list_ctime():
+    # check that creation times are within a day
+    before = datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta(days=1)
+
+    client = get_client()
+    for i in range(5):
+        client.create_bucket(Bucket=get_new_bucket_name())
+
+    response = client.list_buckets()
+    for bucket in response['Buckets']:
+        ctime = bucket['CreationDate']
+        assert before <= ctime, '%r > %r' % (before, ctime)
+
 @attr(resource='bucket')
 @attr(method='get')
 @attr(operation='list all buckets (anonymous)')