forked from TrueCloudLab/s3-tests
Fix wrong assertion of the test: test_buckets_list_ctime
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>
This commit is contained in:
parent
54c1488a43
commit
e9c5cc29e9
1 changed files with 7 additions and 3 deletions
|
@ -5266,11 +5266,15 @@ def test_buckets_list_ctime():
|
||||||
before = datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta(days=1)
|
before = datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta(days=1)
|
||||||
|
|
||||||
client = get_client()
|
client = get_client()
|
||||||
|
buckets = []
|
||||||
for i in range(5):
|
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()
|
response = client.list_buckets()
|
||||||
for bucket in response['Buckets']:
|
for bucket in response['Buckets']:
|
||||||
|
if bucket['Name'] in buckets:
|
||||||
ctime = bucket['CreationDate']
|
ctime = bucket['CreationDate']
|
||||||
assert before <= ctime, '%r > %r' % (before, ctime)
|
assert before <= ctime, '%r > %r' % (before, ctime)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue