From 8e8a5b6efd99a0dbad13251dea260ebe54a0a94b Mon Sep 17 00:00:00 2001 From: Vladimir Domnich Date: Fri, 14 Oct 2022 20:56:15 +0400 Subject: [PATCH] Pass shell where it was missed Signed-off-by: Vladimir Domnich --- .../acl/storage_group/test_storagegroup.py | 52 +++++++++++++------ pytest_tests/testsuites/conftest.py | 5 +- .../lib/python_keywords/storage_group.py | 6 +-- 3 files changed, 44 insertions(+), 19 deletions(-) diff --git a/pytest_tests/testsuites/acl/storage_group/test_storagegroup.py b/pytest_tests/testsuites/acl/storage_group/test_storagegroup.py index 41fd99c2..e3079c49 100644 --- a/pytest_tests/testsuites/acl/storage_group/test_storagegroup.py +++ b/pytest_tests/testsuites/acl/storage_group/test_storagegroup.py @@ -15,6 +15,7 @@ from common import ( from epoch import tick_epoch from file_helper import generate_file from grpc_responses import OBJECT_ACCESS_DENIED, OBJECT_NOT_FOUND +from neofs_testlib.shell import Shell from python_keywords.acl import ( EACLAccess, EACLOperation, @@ -64,12 +65,14 @@ class TestStorageGroup: objects = [oid] storage_group = put_storagegroup(self.main_wallet, cid, objects) - self.expect_success_for_storagegroup_operations(self.main_wallet, cid, objects, object_size) + self.expect_success_for_storagegroup_operations( + self.main_wallet, cid, objects, object_size, client_shell + ) self.expect_failure_for_storagegroup_operations( self.other_wallet, cid, objects, storage_group ) self.storagegroup_operations_by_system_ro_container( - self.main_wallet, cid, objects, object_size + self.main_wallet, cid, objects, object_size, client_shell ) @allure.title("Test Storage Group in Public Container") @@ -78,12 +81,14 @@ class TestStorageGroup: file_path = generate_file(object_size) oid = put_object(self.main_wallet, file_path, cid, shell=client_shell) objects = [oid] - self.expect_success_for_storagegroup_operations(self.main_wallet, cid, objects, object_size) self.expect_success_for_storagegroup_operations( - self.other_wallet, cid, objects, object_size + self.main_wallet, cid, objects, object_size, client_shell + ) + self.expect_success_for_storagegroup_operations( + self.other_wallet, cid, objects, object_size, client_shell ) self.storagegroup_operations_by_system_ro_container( - self.main_wallet, cid, objects, object_size + self.main_wallet, cid, objects, object_size, client_shell ) @allure.title("Test Storage Group in Read-Only Container") @@ -92,12 +97,14 @@ class TestStorageGroup: file_path = generate_file(object_size) oid = put_object(self.main_wallet, file_path, cid, shell=client_shell) objects = [oid] - self.expect_success_for_storagegroup_operations(self.main_wallet, cid, objects, object_size) + self.expect_success_for_storagegroup_operations( + self.main_wallet, cid, objects, object_size, client_shell + ) self.storagegroup_operations_by_other_ro_container( - self.main_wallet, self.other_wallet, cid, objects, object_size + self.main_wallet, self.other_wallet, cid, objects, object_size, client_shell ) self.storagegroup_operations_by_system_ro_container( - self.main_wallet, cid, objects, object_size + self.main_wallet, cid, objects, object_size, client_shell ) @allure.title("Test Storage Group with Bearer Allow") @@ -108,7 +115,9 @@ class TestStorageGroup: file_path = generate_file(object_size) oid = put_object(self.main_wallet, file_path, cid, shell=client_shell) objects = [oid] - self.expect_success_for_storagegroup_operations(self.main_wallet, cid, objects, object_size) + self.expect_success_for_storagegroup_operations( + self.main_wallet, cid, objects, object_size, client_shell + ) storage_group = put_storagegroup(self.main_wallet, cid, objects) eacl_deny = [ EACLRule(access=EACLAccess.DENY, role=role, operation=op) @@ -128,7 +137,7 @@ class TestStorageGroup: ], ) self.expect_success_for_storagegroup_operations( - self.main_wallet, cid, objects, object_size, bearer_file + self.main_wallet, cid, objects, object_size, client_shell, bearer_file ) @allure.title("Test to check Storage Group lifetime") @@ -146,7 +155,12 @@ class TestStorageGroup: @staticmethod @allure.step("Run Storage Group Operations And Expect Success") def expect_success_for_storagegroup_operations( - wallet: str, cid: str, obj_list: list, object_size: int, bearer_token: Optional[str] = None + wallet: str, + cid: str, + obj_list: list, + object_size: int, + shell: Shell, + bearer_token: Optional[str] = None, ): """ This func verifies if the Object's owner is allowed to @@ -155,7 +169,9 @@ class TestStorageGroup: """ storage_group = put_storagegroup(wallet, cid, obj_list, bearer_token) verify_list_storage_group(wallet, cid, storage_group, bearer_token) - verify_get_storage_group(wallet, cid, storage_group, obj_list, object_size, bearer_token) + verify_get_storage_group( + wallet, cid, storage_group, obj_list, object_size, shell, bearer_token + ) delete_storagegroup(wallet, cid, storage_group, bearer_token) @staticmethod @@ -180,20 +196,25 @@ class TestStorageGroup: @staticmethod @allure.step("Run Storage Group Operations On Other's Behalf In RO Container") def storagegroup_operations_by_other_ro_container( - owner_wallet: str, other_wallet: str, cid: str, obj_list: list, object_size: int + owner_wallet: str, + other_wallet: str, + cid: str, + obj_list: list, + object_size: int, + shell: Shell, ): storage_group = put_storagegroup(owner_wallet, cid, obj_list) with pytest.raises(Exception, match=OBJECT_ACCESS_DENIED): put_storagegroup(other_wallet, cid, obj_list) verify_list_storage_group(other_wallet, cid, storage_group) - verify_get_storage_group(other_wallet, cid, storage_group, obj_list, object_size) + verify_get_storage_group(other_wallet, cid, storage_group, obj_list, object_size, shell) with pytest.raises(Exception, match=OBJECT_ACCESS_DENIED): delete_storagegroup(other_wallet, cid, storage_group) @staticmethod @allure.step("Run Storage Group Operations On Systems's Behalf In RO Container") def storagegroup_operations_by_system_ro_container( - wallet: str, cid: str, obj_list: list, object_size: int + wallet: str, cid: str, obj_list: list, object_size: int, shell: Shell ): """ In this func we create a Storage Group on Inner Ring's key behalf @@ -215,6 +236,7 @@ class TestStorageGroup: storage_group, obj_list, object_size, + shell, wallet_config=IR_WALLET_CONFIG, ) with pytest.raises(Exception, match=OBJECT_ACCESS_DENIED): diff --git a/pytest_tests/testsuites/conftest.py b/pytest_tests/testsuites/conftest.py index 52cbac4b..6926ab2f 100644 --- a/pytest_tests/testsuites/conftest.py +++ b/pytest_tests/testsuites/conftest.py @@ -48,7 +48,10 @@ def hosting(configure_testlib) -> Hosting: @pytest.fixture(scope="session") def require_multiple_hosts(hosting: Hosting): - """Fixture that is applied to tests that require that environment has multiple hosts.""" + """Designates tests that require environment with multiple hosts. + + These tests will be skipped on an environment that has only 1 host. + """ if len(hosting.hosts) <= 1: pytest.skip("Test only works with multiple hosts") yield diff --git a/robot/resources/lib/python_keywords/storage_group.py b/robot/resources/lib/python_keywords/storage_group.py index 7844db29..451aca53 100644 --- a/robot/resources/lib/python_keywords/storage_group.py +++ b/robot/resources/lib/python_keywords/storage_group.py @@ -1,5 +1,3 @@ -#!/usr/bin/python3 - """ This module contains keywords for work with Storage Groups. It contains wrappers for `neofs-cli storagegroup` verbs. @@ -10,6 +8,7 @@ import allure from cli_helpers import _cmd_run from common import COMPLEX_OBJ_SIZE, NEOFS_CLI_EXEC, NEOFS_ENDPOINT, SIMPLE_OBJ_SIZE, WALLET_CONFIG from complex_object_actions import get_link_object +from neofs_testlib.shell import Shell from neofs_verbs import head_object logger = logging.getLogger("NeoLogger") @@ -174,6 +173,7 @@ def verify_get_storage_group( storagegroup: str, obj_list: list, object_size: int, + shell: Shell, bearer: str = None, wallet_config: str = WALLET_CONFIG, ): @@ -181,7 +181,7 @@ def verify_get_storage_group( if object_size == COMPLEX_OBJ_SIZE: for obj in obj_list: link_oid = get_link_object( - wallet, cid, obj, bearer_token=bearer, wallet_config=wallet_config + wallet, cid, obj, shell=shell, bearer_token=bearer, wallet_config=wallet_config ) obj_head = head_object( wallet,