diff --git a/pytest_tests/testsuites/access/ape/test_bearer.py b/pytest_tests/testsuites/access/ape/test_bearer.py index 68280810..0e2284aa 100644 --- a/pytest_tests/testsuites/access/ape/test_bearer.py +++ b/pytest_tests/testsuites/access/ape/test_bearer.py @@ -20,6 +20,7 @@ from ....helpers.container_access import ( @pytest.mark.sanity @pytest.mark.bearer @pytest.mark.ape +@pytest.mark.parametrize("user_tag", ["ApeBearer"], indirect=True) # provide dedicated user with no APE side-policies class TestApeBearer(ClusterTestBase): @allure.title("Operations with BearerToken (role={role}, obj_size={object_size})") @pytest.mark.parametrize("role", [ape.Role.OWNER, ape.Role.OTHERS], indirect=True) diff --git a/pytest_tests/testsuites/ape/test_ape_local_object_allow.py b/pytest_tests/testsuites/ape/test_ape_local_object_allow.py index f9624951..7bd9b471 100644 --- a/pytest_tests/testsuites/ape/test_ape_local_object_allow.py +++ b/pytest_tests/testsuites/ape/test_ape_local_object_allow.py @@ -20,6 +20,7 @@ REP1_MSK = ContainerRequest("REP 1 IN MOW CBF 1 SELECT 1 FROM MSK AS MOW FILTER @pytest.mark.ape_object @pytest.mark.ape_allow @pytest.mark.parametrize("container_request", [REP1_MSK], indirect=True) +@pytest.mark.parametrize("user_tag", ["ApeLocalOverrideAllow"], indirect=True) # provide dedicated user with no APE side-policies class TestApeLocalOverrideAllow(ClusterTestBase): @allure.title("LocalOverride: Allow to GetObject in root tenant") def test_local_override_allow_to_get_object_root( diff --git a/pytest_tests/testsuites/conftest.py b/pytest_tests/testsuites/conftest.py index 6e778dfa..2db78aea 100644 --- a/pytest_tests/testsuites/conftest.py +++ b/pytest_tests/testsuites/conftest.py @@ -206,8 +206,8 @@ def ec_placement_policy() -> PlacementPolicy: @pytest.fixture(scope="session") @allure.title("Init Frostfs CLI") -def frostfs_cli(client_shell: Shell, default_wallet: WalletInfo) -> FrostfsCli: - return FrostfsCli(client_shell, FROSTFS_CLI_EXEC, default_wallet.config_path) +def frostfs_cli(client_shell: Shell, wallet: WalletInfo) -> FrostfsCli: + return FrostfsCli(client_shell, FROSTFS_CLI_EXEC, wallet.config_path) @pytest.fixture(scope="session") @@ -287,17 +287,17 @@ def credentials_provider(cluster: Cluster) -> CredentialsProvider: ], ) def s3_client( - default_user: User, + user: User, s3_policy: Optional[str], cluster: Cluster, request: pytest.FixtureRequest, credentials_provider: CredentialsProvider, ) -> S3ClientWrapper: node = cluster.cluster_nodes[0] - credentials_provider.S3.provide(default_user, node, s3_policy) + credentials_provider.S3.provide(user, node, s3_policy) s3_client_cls = request.param - client = s3_client_cls(default_user.s3_credentials.access_key, default_user.s3_credentials.secret_key, cluster.default_s3_gate_endpoint) + client = s3_client_cls(user.s3_credentials.access_key, user.s3_credentials.secret_key, cluster.default_s3_gate_endpoint) return client @@ -443,10 +443,36 @@ def default_user(credentials_provider: CredentialsProvider, cluster: Cluster) -> return user +@pytest.fixture(scope="session") +def user_tag(request: pytest.FixtureRequest) -> str: + tag = "default" + if "param" in request.__dict__: + tag = request.param + + return tag + + +@pytest.fixture(scope="session") +@cached_fixture(optionals.OPTIONAL_CACHE_FIXTURES) +@reporter.step("Create {user_tag} user") +def user(user_tag: str) -> User: + user = User(string_utils.unique_name("user-")) + user.attributes["tag"] = user_tag + + return user + + +@pytest.fixture(scope="session") +def wallet(user: User, credentials_provider: CredentialsProvider, cluster: Cluster) -> WalletInfo: + credentials_provider.GRPC.provide(user, cluster.cluster_nodes[0]) + return user.wallet + + +# TODO: Migrate tests to fixture wallet above @reporter.step("Get wallet for default user") @pytest.fixture(scope="session") -def default_wallet(default_user: User) -> WalletInfo: - return default_user.wallet +def default_wallet(wallet) -> WalletInfo: + return wallet @pytest.fixture(scope="session") @@ -524,26 +550,26 @@ def multiple_containers_request(request: pytest.FixtureRequest) -> ContainerRequ @pytest.fixture def container( - default_wallet: WalletInfo, + wallet: WalletInfo, frostfs_cli: FrostfsCli, client_shell: Shell, cluster: Cluster, rpc_endpoint: str, container_request: ContainerRequest, ) -> str: - return create_container_with_ape(container_request, frostfs_cli, default_wallet, client_shell, cluster, rpc_endpoint) + return create_container_with_ape(container_request, frostfs_cli, wallet, client_shell, cluster, rpc_endpoint) @pytest.fixture def containers( - default_wallet: WalletInfo, + wallet: WalletInfo, frostfs_cli: FrostfsCli, client_shell: Shell, cluster: Cluster, rpc_endpoint: str, multiple_containers_request: MultipleContainersRequest, ) -> list[str]: - return create_containers_with_ape(frostfs_cli, default_wallet, client_shell, cluster, rpc_endpoint, multiple_containers_request) + return create_containers_with_ape(frostfs_cli, wallet, client_shell, cluster, rpc_endpoint, multiple_containers_request) @pytest.fixture()