Pass shell where it was missed

Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
This commit is contained in:
Vladimir Domnich 2022-10-14 20:56:15 +04:00 committed by Vladimir
parent 4b3a5f60c4
commit 8e8a5b6efd
3 changed files with 44 additions and 19 deletions

View file

@ -15,6 +15,7 @@ from common import (
from epoch import tick_epoch from epoch import tick_epoch
from file_helper import generate_file from file_helper import generate_file
from grpc_responses import OBJECT_ACCESS_DENIED, OBJECT_NOT_FOUND from grpc_responses import OBJECT_ACCESS_DENIED, OBJECT_NOT_FOUND
from neofs_testlib.shell import Shell
from python_keywords.acl import ( from python_keywords.acl import (
EACLAccess, EACLAccess,
EACLOperation, EACLOperation,
@ -64,12 +65,14 @@ class TestStorageGroup:
objects = [oid] objects = [oid]
storage_group = put_storagegroup(self.main_wallet, cid, objects) 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.expect_failure_for_storagegroup_operations(
self.other_wallet, cid, objects, storage_group self.other_wallet, cid, objects, storage_group
) )
self.storagegroup_operations_by_system_ro_container( 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") @allure.title("Test Storage Group in Public Container")
@ -78,12 +81,14 @@ class TestStorageGroup:
file_path = generate_file(object_size) file_path = generate_file(object_size)
oid = put_object(self.main_wallet, file_path, cid, shell=client_shell) oid = put_object(self.main_wallet, file_path, cid, shell=client_shell)
objects = [oid] objects = [oid]
self.expect_success_for_storagegroup_operations(self.main_wallet, cid, objects, object_size)
self.expect_success_for_storagegroup_operations( 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.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") @allure.title("Test Storage Group in Read-Only Container")
@ -92,12 +97,14 @@ class TestStorageGroup:
file_path = generate_file(object_size) file_path = generate_file(object_size)
oid = put_object(self.main_wallet, file_path, cid, shell=client_shell) oid = put_object(self.main_wallet, file_path, cid, shell=client_shell)
objects = [oid] 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.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.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") @allure.title("Test Storage Group with Bearer Allow")
@ -108,7 +115,9 @@ class TestStorageGroup:
file_path = generate_file(object_size) file_path = generate_file(object_size)
oid = put_object(self.main_wallet, file_path, cid, shell=client_shell) oid = put_object(self.main_wallet, file_path, cid, shell=client_shell)
objects = [oid] 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) storage_group = put_storagegroup(self.main_wallet, cid, objects)
eacl_deny = [ eacl_deny = [
EACLRule(access=EACLAccess.DENY, role=role, operation=op) EACLRule(access=EACLAccess.DENY, role=role, operation=op)
@ -128,7 +137,7 @@ class TestStorageGroup:
], ],
) )
self.expect_success_for_storagegroup_operations( 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") @allure.title("Test to check Storage Group lifetime")
@ -146,7 +155,12 @@ class TestStorageGroup:
@staticmethod @staticmethod
@allure.step("Run Storage Group Operations And Expect Success") @allure.step("Run Storage Group Operations And Expect Success")
def expect_success_for_storagegroup_operations( 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 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) storage_group = put_storagegroup(wallet, cid, obj_list, bearer_token)
verify_list_storage_group(wallet, cid, storage_group, 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) delete_storagegroup(wallet, cid, storage_group, bearer_token)
@staticmethod @staticmethod
@ -180,20 +196,25 @@ class TestStorageGroup:
@staticmethod @staticmethod
@allure.step("Run Storage Group Operations On Other's Behalf In RO Container") @allure.step("Run Storage Group Operations On Other's Behalf In RO Container")
def storagegroup_operations_by_other_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) storage_group = put_storagegroup(owner_wallet, cid, obj_list)
with pytest.raises(Exception, match=OBJECT_ACCESS_DENIED): with pytest.raises(Exception, match=OBJECT_ACCESS_DENIED):
put_storagegroup(other_wallet, cid, obj_list) put_storagegroup(other_wallet, cid, obj_list)
verify_list_storage_group(other_wallet, cid, storage_group) 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): with pytest.raises(Exception, match=OBJECT_ACCESS_DENIED):
delete_storagegroup(other_wallet, cid, storage_group) delete_storagegroup(other_wallet, cid, storage_group)
@staticmethod @staticmethod
@allure.step("Run Storage Group Operations On Systems's Behalf In RO Container") @allure.step("Run Storage Group Operations On Systems's Behalf In RO Container")
def storagegroup_operations_by_system_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 In this func we create a Storage Group on Inner Ring's key behalf
@ -215,6 +236,7 @@ class TestStorageGroup:
storage_group, storage_group,
obj_list, obj_list,
object_size, object_size,
shell,
wallet_config=IR_WALLET_CONFIG, wallet_config=IR_WALLET_CONFIG,
) )
with pytest.raises(Exception, match=OBJECT_ACCESS_DENIED): with pytest.raises(Exception, match=OBJECT_ACCESS_DENIED):

View file

@ -48,7 +48,10 @@ def hosting(configure_testlib) -> Hosting:
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def require_multiple_hosts(hosting: Hosting): 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: if len(hosting.hosts) <= 1:
pytest.skip("Test only works with multiple hosts") pytest.skip("Test only works with multiple hosts")
yield yield

View file

@ -1,5 +1,3 @@
#!/usr/bin/python3
""" """
This module contains keywords for work with Storage Groups. This module contains keywords for work with Storage Groups.
It contains wrappers for `neofs-cli storagegroup` verbs. It contains wrappers for `neofs-cli storagegroup` verbs.
@ -10,6 +8,7 @@ import allure
from cli_helpers import _cmd_run from cli_helpers import _cmd_run
from common import COMPLEX_OBJ_SIZE, NEOFS_CLI_EXEC, NEOFS_ENDPOINT, SIMPLE_OBJ_SIZE, WALLET_CONFIG 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 complex_object_actions import get_link_object
from neofs_testlib.shell import Shell
from neofs_verbs import head_object from neofs_verbs import head_object
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")
@ -174,6 +173,7 @@ def verify_get_storage_group(
storagegroup: str, storagegroup: str,
obj_list: list, obj_list: list,
object_size: int, object_size: int,
shell: Shell,
bearer: str = None, bearer: str = None,
wallet_config: str = WALLET_CONFIG, wallet_config: str = WALLET_CONFIG,
): ):
@ -181,7 +181,7 @@ def verify_get_storage_group(
if object_size == COMPLEX_OBJ_SIZE: if object_size == COMPLEX_OBJ_SIZE:
for obj in obj_list: for obj in obj_list:
link_oid = get_link_object( 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( obj_head = head_object(
wallet, wallet,