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

Update skipped s3 tests #671

Merged
merged 2 commits into from
Nov 15, 2023
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
12 changes: 12 additions & 0 deletions pytest_tests/helpers/s3_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,15 @@ def assert_s3_acl(acl_grants: list, permitted_users: str):
assert permission == "FULL_CONTROL", "Only CanonicalUser should have FULL_CONTROL"
else:
raise AssertionError("FULL_CONTROL is given to All Users")

def parametrize_clients(metafunc):
if "s3_client" in metafunc.fixturenames:
clients = ["aws cli", "boto3"]
for mark in metafunc.definition.own_markers:
if mark.name == "aws_cli_only":
clients = ["aws cli"]
break
if mark.name == "boto3_only":
clients = ["boto3"]
break
metafunc.parametrize("s3_client", clients, indirect=True)
2 changes: 0 additions & 2 deletions pytest_tests/steps/s3_gate_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,6 @@ def put_object_acl_s3(
grant_write: Optional[str] = None,
grant_read: Optional[str] = None,
) -> list:
if not isinstance(s3_client, AwsCliClient):
pytest.skip("Method put_object_acl is not supported by boto3 client")
params = {"Bucket": bucket, "Key": object_key}
if acl:
params.update({"ACL": acl})
Expand Down
13 changes: 3 additions & 10 deletions pytest_tests/testsuites/services/s3_gate/test_s3_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
check_tags_by_object,
set_bucket_versioning,
try_to_get_objects_and_expect_error,
parametrize_clients
)

from steps import s3_gate_bucket, s3_gate_object
Expand All @@ -29,8 +30,7 @@


def pytest_generate_tests(metafunc):
if "s3_client" in metafunc.fixturenames:
metafunc.parametrize("s3_client", ["aws cli", "boto3"], indirect=True)
parametrize_clients(metafunc)


@allure.link("https://github.com/nspcc-dev/neofs-s3-gw#neofs-s3-gateway", name="neofs-s3-gateway")
Expand Down Expand Up @@ -137,6 +137,7 @@ def test_s3_api_object(self, file_type, two_buckets, simple_object_size, complex
s3_gate_object.get_object_attributes(self.s3_client, bucket, file_name, *attrs)

@allure.title("Test S3 Sync directory")
@pytest.mark.aws_cli_only
def test_s3_sync_dir(self, bucket, simple_object_size):
"""
Test checks sync directory with AWS CLI utility.
Expand All @@ -145,8 +146,6 @@ def test_s3_sync_dir(self, bucket, simple_object_size):
file_path_2 = os.path.join(os.getcwd(), ASSETS_DIR, "test_sync", "test_file_2")
key_to_path = {"test_file_1": file_path_1, "test_file_2": file_path_2}

if not isinstance(self.s3_client, AwsCliClient):
pytest.skip("This test is not supported with boto3 client")

generate_file_with_content(simple_object_size, file_path=file_path_1)
generate_file_with_content(simple_object_size, file_path=file_path_2)
Expand Down Expand Up @@ -355,8 +354,6 @@ def test_s3_api_object_tagging(self, bucket, simple_object_size):
check_tags_by_object(self.s3_client, bucket, obj_key, [])

@allure.title("Test S3: Delete object & delete objects S3 API")
@pytest.mark.skip(reason="https://github.com/nspcc-dev/neofs-testcases/issues/559")
@pytest.mark.nspcc_dev__neofs_testcases__issue_559
def test_s3_api_delete(self, two_buckets, simple_object_size, complex_object_size):
"""
Check delete_object and delete_objects S3 API operation. From first bucket some objects deleted one by one.
Expand Down Expand Up @@ -412,8 +409,6 @@ def test_s3_api_delete(self, two_buckets, simple_object_size, complex_object_siz
), f"Expected all objects {put_objects} in objects list {bucket_objects}"
try_to_get_objects_and_expect_error(self.s3_client, bucket_2, objects_to_delete_b2)

@pytest.mark.skip(reason="https://github.com/nspcc-dev/neofs-testcases/issues/535")
@pytest.mark.nspcc_dev__neofs_testcases__issue_535
@allure.title("Test S3: Copy object to the same bucket")
def test_s3_copy_same_bucket(self, bucket, complex_object_size, simple_object_size):
"""
Expand Down Expand Up @@ -458,8 +453,6 @@ def test_s3_copy_same_bucket(self, bucket, complex_object_size, simple_object_si
unexpected_objects=[file_name_simple],
)

@pytest.mark.skip(reason="https://github.com/nspcc-dev/neofs-testcases/issues/535")
@pytest.mark.nspcc_dev__neofs_testcases__issue_535
@allure.title("Test S3: Copy object to another bucket")
def test_s3_copy_to_another_bucket(self, two_buckets, complex_object_size, simple_object_size):
"""
Expand Down
8 changes: 3 additions & 5 deletions pytest_tests/testsuites/services/s3_gate/test_s3_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
assert_s3_acl,
check_objects_in_bucket,
set_bucket_versioning,
parametrize_clients
)

from steps import s3_gate_bucket, s3_gate_object
from steps.s3_gate_base import TestS3GateBase


def pytest_generate_tests(metafunc):
if "s3_client" in metafunc.fixturenames:
metafunc.parametrize("s3_client", ["aws cli", "boto3"], indirect=True)
parametrize_clients(metafunc)


@pytest.mark.s3_gate
Expand Down Expand Up @@ -685,7 +685,6 @@ def prepare_two_wallets(self, default_wallet, client_shell):
)

@allure.title("Test S3: put object with ACL")
@pytest.mark.skip(reason="https://github.com/nspcc-dev/neofs-s3-gw/issues/791")
@pytest.mark.parametrize("bucket_versioning", ["ENABLED", "SUSPENDED"])
def test_s3_put_object_acl(
self,
Expand Down Expand Up @@ -851,14 +850,13 @@ def test_s3_put_object_lock_mode(self, complex_object_size, simple_object_size):

@allure.title("Test S3 Sync directory")
@pytest.mark.parametrize("sync_type", ["sync", "cp"])
@pytest.mark.aws_cli_only
def test_s3_sync_dir(self, sync_type, bucket, simple_object_size):
file_path_1 = os.path.join(os.getcwd(), ASSETS_DIR, "test_sync", "test_file_1")
file_path_2 = os.path.join(os.getcwd(), ASSETS_DIR, "test_sync", "test_file_2")
object_metadata = {f"{uuid.uuid4()}": f"{uuid.uuid4()}"}
key_to_path = {"test_file_1": file_path_1, "test_file_2": file_path_2}

if not isinstance(self.s3_client, AwsCliClient):
pytest.skip("This test is not supported with boto3 client")

generate_file_with_content(simple_object_size, file_path=file_path_1)
generate_file_with_content(simple_object_size, file_path=file_path_2)
Expand Down
Loading