diff --git a/neofs-testlib/neofs_testlib/env/env.py b/neofs-testlib/neofs_testlib/env/env.py index 358214a4f..805e15996 100644 --- a/neofs-testlib/neofs_testlib/env/env.py +++ b/neofs-testlib/neofs_testlib/env/env.py @@ -931,6 +931,13 @@ def _wait_until_ready(self): assert "Health status: READY" in result.stdout, "Health is not ready" assert "Network status: ONLINE" in result.stdout, "Network is not online" + def _get_version(self) -> str: + raw_version_output = self.neofs_env._run_single_command(self.neofs_env.neofs_node_path, "--version") + for line in raw_version_output.splitlines(): + if "Version:" in line: + return line.split("Version:")[1].strip() + return "" + class S3_GW: def __init__(self, neofs_env: NeoFSEnv): diff --git a/pytest_tests/lib/helpers/grpc_responses.py b/pytest_tests/lib/helpers/grpc_responses.py index 30965a0f8..39220b715 100644 --- a/pytest_tests/lib/helpers/grpc_responses.py +++ b/pytest_tests/lib/helpers/grpc_responses.py @@ -8,6 +8,7 @@ MALFORMED_REQUEST = "code = 1024.*message = malformed request" WRONG_CONTAINER = "code = 1024.*message = wrong container" SESSION_NOT_ISSUED_BY_OWNER = "code = 1024.*message = session was not issued by the container owner" +INVALID_SESSION_TOKEN_OWNER = "code = 1024.*message = malformed request: invalid session token owner.*" OBJECT_ACCESS_DENIED = "code = 2048.*message = access to object operation denied" OBJECT_NOT_FOUND = "code = 2049.*message = object not found" OBJECT_ALREADY_REMOVED = "code = 2052.*message = object already removed" @@ -34,6 +35,7 @@ NOT_SESSION_CONTAINER_OWNER = "session issuer differs with the container owner" TIMED_OUT = "timed out after \\d+ seconds" CONTAINER_DELETION_TIMED_OUT = "container deletion: await timeout expired" +CONTAINER_CREATION_TIMED_OUT = "container creation: await timeout expired" EACL_TIMED_OUT = "eACL setting: await timeout expired" EACL_TABLE_IS_NOT_SET = "extended ACL table is not set for this container" diff --git a/pytest_tests/tests/session_token/test_static_object_session_token.py b/pytest_tests/tests/session_token/test_static_object_session_token.py index 94ee6049e..8bd41c281 100644 --- a/pytest_tests/tests/session_token/test_static_object_session_token.py +++ b/pytest_tests/tests/session_token/test_static_object_session_token.py @@ -7,6 +7,7 @@ from helpers.file_helper import generate_file from helpers.grpc_responses import ( EXPIRED_SESSION_TOKEN, + INVALID_SESSION_TOKEN_OWNER, MALFORMED_REQUEST, OBJECT_ACCESS_DENIED, OBJECT_NOT_FOUND, @@ -352,7 +353,10 @@ def test_static_session_signed_by_other( temp_directory, ) signed_token_file = sign_session_token(self.shell, session_token_file, stranger_wallet) - with pytest.raises(Exception, match=OBJECT_ACCESS_DENIED): + expected_error = INVALID_SESSION_TOKEN_OWNER + if self.neofs_env.storage_nodes[0]._get_version() <= "0.43.0": + expected_error = OBJECT_ACCESS_DENIED + with pytest.raises(Exception, match=expected_error): head_object( user_wallet.path, storage_object.cid, diff --git a/pytest_tests/tests/session_token/test_static_session_token_container.py b/pytest_tests/tests/session_token/test_static_session_token_container.py index ab8d1dabc..497e2d89a 100644 --- a/pytest_tests/tests/session_token/test_static_session_token_container.py +++ b/pytest_tests/tests/session_token/test_static_session_token_container.py @@ -12,6 +12,7 @@ from helpers.container import create_container, delete_container, get_container, list_containers from helpers.file_helper import generate_file from helpers.grpc_responses import ( + CONTAINER_CREATION_TIMED_OUT, CONTAINER_DELETION_TIMED_OUT, EACL_TIMED_OUT, INVALID_EXP, @@ -201,10 +202,11 @@ def test_static_session_token_container_create_with_other_wallet( wait_for_creation=False, ) - @pytest.mark.skip(reason="https://github.com/nspcc-dev/neofs-node/issues/2947") def test_static_session_token_container_create_signed_with_wrong_wallet( self, owner_wallet: NodeWallet, user_wallet: NodeWallet, stranger_wallet: NodeWallet, temp_directory: str ): + if self.neofs_env.storage_nodes[0]._get_version() <= "0.43.0": + pytest.skip("This test runs only on post 0.43.0 neofs-node version") session_token_file = generate_container_session_token( owner_wallet=user_wallet, session_wallet=user_wallet, @@ -213,7 +215,7 @@ def test_static_session_token_container_create_signed_with_wrong_wallet( ) container_token = sign_session_token(self.shell, session_token_file, stranger_wallet) - with pytest.raises(RuntimeError): + with pytest.raises(Exception, match=CONTAINER_CREATION_TIMED_OUT): create_container( user_wallet.path, session_token=container_token,