Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failure seen with mfa testcase #561

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading