Skip to content

Commit

Permalink
Merge pull request #561 from ckulal/fix_mfa_failure
Browse files Browse the repository at this point in the history
Fix failure seen with mfa testcase
  • Loading branch information
mergify[bot] authored Feb 28, 2024
2 parents c6bfcd8 + 672a3b3 commit 7d0f766
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
11 changes: 2 additions & 9 deletions rgw/v2/tests/s3_swift/reusable.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,15 +614,8 @@ def enable_mfa_versioning(
),
}
)

if mfa_version_put is False:
return token, mfa_version_put

response = HttpResponseParser(mfa_version_put)
if response.status_code == 200:
log.info("MFA and version enabled")
else:
raise MFAVersionError("bucket mfa and versioning enable failed")
log.info(f"mfa_version_put: {mfa_version_put}")
return token, mfa_version_put


def put_get_bucket_lifecycle_test(
Expand Down
13 changes: 11 additions & 2 deletions rgw/v2/tests/s3_swift/test_rgw_mfa.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

import v2.lib.resource_op as s3lib
import v2.utils.utils as utils
from v2.lib.exceptions import RGWBaseException, TestExecError
from v2.lib.exceptions import MFAVersionError, RGWBaseException, TestExecError
from v2.lib.resource_op import Config
from v2.lib.rgw_config_opts import CephConfOp, ConfigOpts
from v2.lib.s3.auth import Auth
from v2.lib.s3.write_io_info import BasicIOInfoStructure, BucketIoInfo, IOInfoInitialize
from v2.tests.s3_swift import reusable
from v2.utils.log import configure_logging
from v2.utils.test_desc import AddTestInfo
from v2.utils.utils import RGWService
from v2.utils.utils import HttpResponseParser, RGWService

log = logging.getLogger()
TEST_DATA_PATH = None
Expand Down Expand Up @@ -146,6 +146,15 @@ def test_exec(config, ssh_con):
token, status = reusable.enable_mfa_versioning(
bucket, rgw_conn, SEED, serial, each_user, write_bucket_io_info
)
if status:
response = HttpResponseParser(status)
if response.status_code == 200:
log.info("MFA and version enabled")
else:
raise MFAVersionError(
"bucket mfa and versioning enable failed"
)

if status is False:
log.info("trying again! AccessDenied could be a timing issue!")
new_token = reusable.generate_totp(SEED)
Expand Down

0 comments on commit 7d0f766

Please sign in to comment.