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

Bunch of fixes for s3 tests #76

Merged
merged 3 commits into from
Aug 20, 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
3 changes: 2 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def neofs_setup(request, temp_directory):

alt_wallet = create_wallet()

(alt_access_key_id, alt_secret_access_key, alt_wallet_public_key, _) = (
(alt_access_key_id, alt_secret_access_key, alt_wallet_public_key, alt_wallet_address) = (
init_s3_credentials(alt_wallet, neofs_env)
)

Expand All @@ -165,6 +165,7 @@ def neofs_setup(request, temp_directory):
S3_MAIN_USER_ID=main_wallet_public_key,
S3_MAIN_ACCESS_KEY=main_access_key_id,
S3_MAIN_SECRET_KEY=main_secret_access_key,
S3_ALT_DISPLAY_NAME=alt_wallet_address,
S3_ALT_USER_ID=alt_wallet_public_key,
S3_ALT_ACCESS_KEY=alt_access_key_id,
S3_ALT_SECRET_KEY=alt_secret_access_key,
Expand Down
2 changes: 1 addition & 1 deletion s3tests.conf.SAMPLE
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ secret_key = {{ S3_MAIN_SECRET_KEY }}

[s3 alt]
# alt display_name set in vstart.sh
display_name = john.doe
display_name = {{ S3_ALT_DISPLAY_NAME }}
## alt email set in vstart.sh
email = [email protected]

Expand Down
46 changes: 17 additions & 29 deletions s3tests_boto3/functional/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,7 @@ def get_client(client_config=None):
verify=config.default_ssl_verify,
config=client_config,
)
allure.attach("Client created with the following options:\n"+
f"{client._client_config._user_provided_options}")
allure.attach(str(client._client_config._user_provided_options), "Client Options", allure.attachment_type.TEXT)
return client


Expand All @@ -436,8 +435,7 @@ def get_v2_client():
verify=config.default_ssl_verify,
config=Config(signature_version="s3"),
)
allure.attach("Client V2 created with the following options:\n"+
f"{client._client_config._user_provided_options}")
allure.attach(str(client._client_config._user_provided_options), "Client V2 Options", allure.attachment_type.TEXT)
return client


Expand All @@ -456,8 +454,7 @@ def get_sts_client(client_config=None):
verify=config.default_ssl_verify,
config=client_config,
)
allure.attach("Client created with the following options:\n"+
f"{client._client_config._user_provided_options}")
allure.attach(str(client._client_config._user_provided_options), "Client Options", allure.attachment_type.TEXT)
return client


Expand Down Expand Up @@ -494,8 +491,7 @@ def get_iam_client(client_config=None):
verify=config.default_ssl_verify,
config=client_config,
)
allure.attach("Client created with the following options:\n"+
f"{client._client_config._user_provided_options}")
allure.attach(str(client._client_config._user_provided_options), "Client Options", allure.attachment_type.TEXT)
return client


Expand All @@ -512,8 +508,7 @@ def get_iam_s3client(client_config=None):
verify=config.default_ssl_verify,
config=client_config,
)
allure.attach("Client created with the following options:\n"+
f"{client._client_config._user_provided_options}")
allure.attach(str(client._client_config._user_provided_options), "Client Options", allure.attachment_type.TEXT)
return client


Expand All @@ -531,8 +526,7 @@ def get_alt_client(client_config=None):
verify=config.default_ssl_verify,
config=client_config,
)
allure.attach("Client created with the following options:\n"+
f"{client._client_config._user_provided_options}")
allure.attach(str(client._client_config._user_provided_options), "Client Options", allure.attachment_type.TEXT)
return client


Expand All @@ -549,8 +543,7 @@ def get_cloud_client(client_config=None):
use_ssl=config.cloud_is_secure,
config=client_config,
)
allure.attach("Client created with the following options:\n"+
f"{client._client_config._user_provided_options}")
allure.attach(str(client._client_config._user_provided_options), "Client Options", allure.attachment_type.TEXT)
return client


Expand All @@ -568,8 +561,7 @@ def get_tenant_client(client_config=None):
verify=config.default_ssl_verify,
config=client_config,
)
allure.attach("Client created with the following options:\n"+
f"{client._client_config._user_provided_options}")
allure.attach(str(client._client_config._user_provided_options), "Client Options", allure.attachment_type.TEXT)
return client


Expand All @@ -584,8 +576,7 @@ def get_tenant_iam_client():
verify=config.default_ssl_verify,
use_ssl=config.default_is_secure,
)
allure.attach("Client created with the following options:\n"+
f"{client._client_config._user_provided_options}")
allure.attach(str(client._client_config._user_provided_options), "Client Options", allure.attachment_type.TEXT)
return client


Expand All @@ -600,8 +591,7 @@ def get_alt_iam_client():
verify=config.default_ssl_verify,
use_ssl=config.default_is_secure,
)
allure.attach("Client created with the following options:\n"+
f"{client._client_config._user_provided_options}")
allure.attach(str(client._client_config._user_provided_options), "Client Options", allure.attachment_type.TEXT)
return client


Expand All @@ -616,8 +606,7 @@ def get_unauthenticated_client():
verify=config.default_ssl_verify,
config=Config(signature_version=UNSIGNED),
)
allure.attach("Client created with the following options:\n"+
f"{client._client_config._user_provided_options}")
allure.attach(str(client._client_config._user_provided_options), "Client Options", allure.attachment_type.TEXT)
return client


Expand All @@ -632,8 +621,7 @@ def get_bad_auth_client(aws_access_key_id="badauth"):
verify=config.default_ssl_verify,
config=Config(signature_version="s3v4"),
)
allure.attach("Client created with the following options:\n"+
f"{client._client_config._user_provided_options}")
allure.attach(str(client._client_config._user_provided_options), "Client Options", allure.attachment_type.TEXT)
return client


Expand All @@ -651,8 +639,7 @@ def get_svc_client(client_config=None, svc="s3"):
verify=config.default_ssl_verify,
config=client_config,
)
allure.attach("Client created with the following options:\n"+
f"{client._client_config._user_provided_options}")
allure.attach(str(client._client_config._user_provided_options), "Client Options", allure.attachment_type.TEXT)
return client


Expand All @@ -672,7 +659,7 @@ def get_new_bucket_name():
prefix=prefix,
num=next(bucket_counter),
)
allure.attach(f"Buket name: {name}")
allure.attach(name, "Bucket name", allure.attachment_type.TEXT)
return name


Expand Down Expand Up @@ -941,8 +928,9 @@ def wrapper(*args, **kwargs):
with allure.step(f"Request {original_method.__name__}"):
response = original_method(*args, **kwargs)
allure.attach(str({'args': args, 'kwargs': kwargs}),
name=f'{original_method.__name__} executed with parameters')
allure.attach(str(response))
f'{original_method.__name__} executed with parameters',
allure.attachment_type.TEXT)
allure.attach(str(response), "Response", allure.attachment_type.TEXT)
return response
return wrapper

Expand Down
8 changes: 4 additions & 4 deletions s3tests_boto3/functional/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -4289,7 +4289,7 @@ def _test_object_raw_get_x_amz_expires_not_expired(client):
)

res = requests.options(url, verify=get_config_ssl_verify()).__dict__
assert res["status_code"] == 403
assert res["status_code"] == 400

res = requests.get(url, verify=get_config_ssl_verify()).__dict__
assert res["status_code"] == 200
Expand Down Expand Up @@ -5199,7 +5199,7 @@ def add_obj_user_grant(bucket_name, key, grant):

grant = {
"Grants": grants,
"Owner": {"DisplayName": main_display_name, "ID": main_user_id},
"Owner": {"DisplayName": main_display_name, "ID": main_display_name},
}

return grant
Expand All @@ -5223,7 +5223,7 @@ def test_object_acl_full_control_verify_attributes():
content_type = response["ContentType"]
etag = response["ETag"]

alt_user_id = get_alt_user_id()
alt_user_id = get_alt_display_name()

grant = {
"Grantee": {"ID": alt_user_id, "Type": "CanonicalUser"},
Expand Down Expand Up @@ -5269,7 +5269,7 @@ def add_bucket_user_grant(bucket_name, grant):

grant = {
"Grants": grants,
"Owner": {"DisplayName": main_display_name, "ID": main_user_id},
"Owner": {"DisplayName": main_display_name, "ID": main_display_name},
}

return grant
Expand Down
Loading