From 967f4f37d900dd6f5c18f9cf24fb645c965cc8f4 Mon Sep 17 00:00:00 2001 From: Dmitriy Zayakin Date: Thu, 7 Sep 2023 10:18:18 +0300 Subject: [PATCH] Change file_pith fixture and change title test acl Signed-off-by: Dmitriy Zayakin --- pytest_tests/testsuites/acl/conftest.py | 13 ++++++++++--- pytest_tests/testsuites/acl/test_acl.py | 6 +++--- pytest_tests/testsuites/acl/test_bearer.py | 4 ++-- pytest_tests/testsuites/acl/test_eacl.py | 8 ++++---- pytest_tests/testsuites/acl/test_eacl_filters.py | 10 +++++++--- .../testsuites/failovers/test_failover_storage.py | 2 +- 6 files changed, 27 insertions(+), 16 deletions(-) diff --git a/pytest_tests/testsuites/acl/conftest.py b/pytest_tests/testsuites/acl/conftest.py index 5be6394..a953d69 100644 --- a/pytest_tests/testsuites/acl/conftest.py +++ b/pytest_tests/testsuites/acl/conftest.py @@ -16,6 +16,7 @@ from frostfs_testlib.storage.dataclasses.frostfs_services import InnerRing, Stor from frostfs_testlib.storage.dataclasses.object_size import ObjectSize from frostfs_testlib.utils import wallet_utils from frostfs_testlib.utils.file_utils import generate_file +from pytest_lazyfixture import lazy_fixture OBJECT_COUNT = 5 @@ -69,9 +70,15 @@ def wallets(default_wallet: str, temp_directory: str, cluster: Cluster) -> Walle ) -@pytest.fixture(scope="module") -def file_path(simple_object_size: ObjectSize) -> str: - yield generate_file(simple_object_size.value) +@pytest.fixture(params=[lazy_fixture("simple_object_size"), lazy_fixture("complex_object_size")]) +def file_size(request: pytest.FixtureRequest) -> int: + size = request.param + return size + + +@pytest.fixture() +def file_path(file_size: ObjectSize) -> str: + yield generate_file(file_size.value) @pytest.fixture(scope="function") diff --git a/pytest_tests/testsuites/acl/test_acl.py b/pytest_tests/testsuites/acl/test_acl.py index 0b76e31..90b4a81 100644 --- a/pytest_tests/testsuites/acl/test_acl.py +++ b/pytest_tests/testsuites/acl/test_acl.py @@ -68,7 +68,7 @@ class TestACLBasic(ClusterTestBase): # with allure.step('Delete public readonly container'): # delete_container(user_wallet.wallet_path, cid_read_only) - @allure.title("Test basic ACL on public container") + @allure.title("Operations with basic ACL on public container (obj_size={file_size})") def test_basic_acl_public(self, wallets: Wallets, public_container: str, file_path: str): """ Test basic ACL set during public container creation. @@ -114,7 +114,7 @@ class TestACLBasic(ClusterTestBase): cluster=self.cluster, ) - @allure.title("Test basic ACL on private container") + @allure.title("Operations with basic ACL on PRIVATE container (obj_size={file_size})") def test_basic_acl_private(self, wallets: Wallets, private_container: str, file_path: str): """ Test basic ACL set during private container creation. @@ -148,7 +148,7 @@ class TestACLBasic(ClusterTestBase): cluster=self.cluster, ) - @allure.title("Test basic ACL on readonly container") + @allure.title("Operations with basic ACL on READONLY container (obj_size={file_size})") def test_basic_acl_readonly( self, wallets: Wallets, client_shell: Shell, read_only_container: str, file_path: str ): diff --git a/pytest_tests/testsuites/acl/test_bearer.py b/pytest_tests/testsuites/acl/test_bearer.py index d16b752..bf004d5 100644 --- a/pytest_tests/testsuites/acl/test_bearer.py +++ b/pytest_tests/testsuites/acl/test_bearer.py @@ -21,7 +21,7 @@ from pytest_tests.testsuites.acl.conftest import Wallets @pytest.mark.acl @pytest.mark.acl_bearer class TestACLBearer(ClusterTestBase): - @allure.title("Validate FrostFS operations with {role.value} BearerToken") + @allure.title("Operations with BearerToken (role={role.value}, obj_size={file_size})") @pytest.mark.parametrize("role", [EACLRole.USER, EACLRole.OTHERS]) def test_bearer_token_operations( self, @@ -113,7 +113,7 @@ class TestACLBearer(ClusterTestBase): cluster=self.cluster, ) - @allure.title("BearerToken Operations for compound Operations") + @allure.title("BearerToken for compound operations (obj_size={file_size})") def test_bearer_token_compound_operations(self, wallets, eacl_container_with_objects): endpoint = self.cluster.default_rpc_endpoint cid, objects_oids, file_path = eacl_container_with_objects diff --git a/pytest_tests/testsuites/acl/test_eacl.py b/pytest_tests/testsuites/acl/test_eacl.py index c56eafa..aaef787 100644 --- a/pytest_tests/testsuites/acl/test_eacl.py +++ b/pytest_tests/testsuites/acl/test_eacl.py @@ -58,7 +58,7 @@ class TestEACLContainer(ClusterTestBase): yield cid, oid, file_path - @allure.title("Deny FrostFS operations for {deny_role.value}") + @allure.title("Deny operations (role={deny_role.value}, obj_size={file_size})") @pytest.mark.parametrize("deny_role", [EACLRole.USER, EACLRole.OTHERS]) def test_extended_acl_deny_all_operations( self, @@ -145,7 +145,7 @@ class TestEACLContainer(ClusterTestBase): cluster=self.cluster, ) - @allure.title("Allow FrostFS operations for only one other pubkey") + @allure.title("Operations for only one other pubkey (obj_size={file_size})") def test_extended_acl_deny_all_operations_exclude_pubkey( self, wallets: Wallets, eacl_container_with_objects: tuple[str, list[str], str] ): @@ -206,7 +206,7 @@ class TestEACLContainer(ClusterTestBase): cluster=self.cluster, ) - @allure.title("Replication with eACL deny rules") + @allure.title("Replication with eACL deny rules (obj_size={file_size})") def test_extended_acl_deny_replication( self, wallets: Wallets, @@ -248,7 +248,7 @@ class TestEACLContainer(ClusterTestBase): storage_nodes, ) - @allure.title("System operations with extended ACL") + @allure.title("Operations with extended ACL for SYSTEM (obj_size={file_size})") def test_extended_actions_system( self, wallets: Wallets, eacl_container_with_objects: tuple[str, list[str], str] ): diff --git a/pytest_tests/testsuites/acl/test_eacl_filters.py b/pytest_tests/testsuites/acl/test_eacl_filters.py index 99a1091..98d6586 100644 --- a/pytest_tests/testsuites/acl/test_eacl_filters.py +++ b/pytest_tests/testsuites/acl/test_eacl_filters.py @@ -128,7 +128,7 @@ class TestEACLFilters(ClusterTestBase): endpoint=self.cluster.default_rpc_endpoint, ) - @allure.title("Validate FrostFS operations with request filter: {match_type}") + @allure.title("Operations with request filter (match_type={match_type}, obj_size={file_size})") @pytest.mark.parametrize( "match_type", [EACLMatchType.STRING_EQUAL, EACLMatchType.STRING_NOT_EQUAL] ) @@ -245,7 +245,9 @@ class TestEACLFilters(ClusterTestBase): bearer=bearer_other, ) - @allure.title("Validate FrostFS operations with deny user headers filter: {match_type}") + @allure.title( + "Operations with deny user headers filter (match_type={match_type}, obj_size={file_size})" + ) @pytest.mark.parametrize( "match_type", [EACLMatchType.STRING_EQUAL, EACLMatchType.STRING_NOT_EQUAL] ) @@ -428,7 +430,9 @@ class TestEACLFilters(ClusterTestBase): bearer=bearer_other_for_put, ) - @allure.title("Validate FrostFS operation with allow eACL user headers filters: {match_type}") + @allure.title( + "Operations with allow eACL user headers filters (match_type={match_type}, obj_size={file_size})" + ) @pytest.mark.parametrize( "match_type", [EACLMatchType.STRING_EQUAL, EACLMatchType.STRING_NOT_EQUAL] ) diff --git a/pytest_tests/testsuites/failovers/test_failover_storage.py b/pytest_tests/testsuites/failovers/test_failover_storage.py index 5807f51..f127ffb 100644 --- a/pytest_tests/testsuites/failovers/test_failover_storage.py +++ b/pytest_tests/testsuites/failovers/test_failover_storage.py @@ -135,7 +135,7 @@ class TestFailoverStorage(ClusterTestBase): oid, 2, shell=self.shell, - nodes=list(set(self.cluster.storage_nodes) - {node}), + nodes=list(set(self.cluster.storage_nodes) - {*stopped_nodes}), ) assert all(old_node not in new_nodes for old_node in nodes)