Skip to content

Commit

Permalink
fix some code
Browse files Browse the repository at this point in the history
Signed-off-by: Mahesh Shetty <[email protected]>
  • Loading branch information
Mahesh Shetty authored and Mahesh Shetty committed Sep 6, 2024
1 parent 50b541e commit 9598d41
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions tests/functional/object/mcg/test_sts_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import pytest
import logging

from botocore.exceptions import ClientError

from uuid import uuid4
from ocs_ci.ocs.resources.bucket_policy import NoobaaAccount
from ocs_ci.ocs.bucket_utils import (
Expand Down Expand Up @@ -219,8 +221,6 @@ def test_sts_assume_role(
if "AccessDenied" not in err.args[0]:
raise
logger.info("Bucket creation failed as expected")
# s3_delete_bucket(mcg_obj_session, bucket_1, mcg_obj_session.assumed_s3_client)
# logger.info(f"Deleted bucket {bucket_1}")
logger.info(s3_list_buckets(mcg_obj_session, mcg_obj_session.assumed_s3_client))

# remove the role from the user
Expand All @@ -241,13 +241,15 @@ def test_sts_assume_role(
mcg_obj=mcg_obj_session,
), "AssumeRole operation expected to fail but it seems to be succeeding even after several tries"

import time

time.sleep(900)

# perform io to validate the role assumption is no longer valid
# new_bucket(bucket_2, mcg_obj_session.assumed_s3_client)
# logger.info(f"Created bucket {bucket_2} again")
logger.info(s3_list_buckets(mcg_obj_session, mcg_obj_session.assumed_s3_client))
# # s3_delete_bucket(mcg_obj_session, bucket_1)
# # logger.info(f"Deleted bucket {bucket_1} again")
assert retry_until_exception(
exception_to_check=ClientError,
tries=20,
delay=60,
backoff=1,
text_in_exception="ExpiredToken",
)(s3_list_buckets)(
mcg_obj_session,
mcg_obj_session.assumed_s3_client,
), "Token doesn't seem to have expired."
logger.info("Token is expired as expected.")

0 comments on commit 9598d41

Please sign in to comment.