Add shell parameter to head_object calls

Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
This commit is contained in:
Vladimir Domnich 2022-10-19 10:26:14 +04:00 committed by Vladimir
parent 3de4d574d3
commit b38403699c
4 changed files with 32 additions and 32 deletions

View file

@ -140,6 +140,7 @@ class TestStorageGroup:
EACLRule(operation=op, access=EACLAccess.ALLOW, role=EACLRole.USER) EACLRule(operation=op, access=EACLAccess.ALLOW, role=EACLRole.USER)
for op in EACLOperation for op in EACLOperation
], ],
shell=client_shell,
) )
self.expect_success_for_storagegroup_operations( self.expect_success_for_storagegroup_operations(
self.main_wallet, cid, objects, object_size, client_shell, bearer_file self.main_wallet, cid, objects, object_size, client_shell, bearer_file
@ -174,9 +175,7 @@ class TestStorageGroup:
""" """
storage_group = put_storagegroup(wallet, cid, obj_list, bearer) storage_group = put_storagegroup(wallet, cid, obj_list, bearer)
verify_list_storage_group(wallet, cid, storage_group, bearer) verify_list_storage_group(wallet, cid, storage_group, bearer)
verify_get_storage_group( verify_get_storage_group(wallet, cid, storage_group, obj_list, object_size, shell, bearer)
wallet, cid, storage_group, obj_list, object_size, shell, bearer
)
delete_storagegroup(wallet, cid, storage_group, bearer) delete_storagegroup(wallet, cid, storage_group, bearer)
@staticmethod @staticmethod

View file

@ -380,7 +380,7 @@ def test_replication(prepare_wallet_and_deposit, after_run_start_all_nodes, host
@pytest.mark.node_mgmt @pytest.mark.node_mgmt
@allure.title("NeoFS object could be dropped using control command") @allure.title("NeoFS object could be dropped using control command")
def test_drop_object(prepare_wallet_and_deposit, hosting: Hosting): def test_drop_object(prepare_wallet_and_deposit, client_shell: Shell, hosting: Hosting):
""" """
Test checks object could be dropped using `neofs-cli control drop-objects` command. Test checks object could be dropped using `neofs-cli control drop-objects` command.
""" """
@ -389,37 +389,42 @@ def test_drop_object(prepare_wallet_and_deposit, hosting: Hosting):
locode = get_locode() locode = get_locode()
rule = f"REP 1 CBF 1 SELECT 1 FROM * FILTER 'UN-LOCODE' EQ '{locode}' AS LOC" rule = f"REP 1 CBF 1 SELECT 1 FROM * FILTER 'UN-LOCODE' EQ '{locode}' AS LOC"
cid = create_container(wallet, rule=rule) cid = create_container(wallet, rule=rule, shell=client_shell)
oid_simple = put_object(wallet, file_path_simple, cid) oid_simple = put_object(wallet, file_path_simple, cid, shell=client_shell)
oid_complex = put_object(wallet, file_path_complex, cid) oid_complex = put_object(wallet, file_path_complex, cid, shell=client_shell)
for oid in (oid_simple, oid_complex): for oid in (oid_simple, oid_complex):
get_object(wallet, cid, oid) get_object(wallet, cid, oid, client_shell)
head_object(wallet, cid, oid) head_object(wallet, cid, oid, client_shell)
nodes = get_nodes_with_object(wallet, cid, oid_simple) nodes = get_nodes_with_object(wallet, cid, oid_simple, shell=client_shell)
node_name = choice( node_name = choice(
[name for name, config in NEOFS_NETMAP_DICT.items() if config.get("rpc") in nodes] [name for name, config in NEOFS_NETMAP_DICT.items() if config.get("rpc") in nodes]
) )
for oid in (oid_simple, oid_complex): for oid in (oid_simple, oid_complex):
with allure.step(f"Drop object {oid}"): with allure.step(f"Drop object {oid}"):
get_object(wallet, cid, oid) get_object(wallet, cid, oid, shell=client_shell)
head_object(wallet, cid, oid) head_object(wallet, cid, oid, shell=client_shell)
drop_object(hosting, node_name, cid, oid) drop_object(hosting, node_name, cid, oid)
wait_for_obj_dropped(wallet, cid, oid, get_object) wait_for_obj_dropped(wallet, cid, oid, client_shell, get_object)
wait_for_obj_dropped(wallet, cid, oid, head_object) wait_for_obj_dropped(wallet, cid, oid, client_shell, head_object)
@pytest.mark.node_mgmt @pytest.mark.node_mgmt
@pytest.mark.skip(reason="Need to clarify scenario") @pytest.mark.skip(reason="Need to clarify scenario")
@allure.title("Control Operations with storage nodes") @allure.title("Control Operations with storage nodes")
def test_shards(prepare_wallet_and_deposit, create_container_and_pick_node, hosting: Hosting): def test_shards(
prepare_wallet_and_deposit,
create_container_and_pick_node,
client_shell: Shell,
hosting: Hosting,
):
wallet = prepare_wallet_and_deposit wallet = prepare_wallet_and_deposit
file_path = generate_file() file_path = generate_file()
cid, node_name = create_container_and_pick_node cid, node_name = create_container_and_pick_node
original_oid = put_object(wallet, file_path, cid) original_oid = put_object(wallet, file_path, cid, shell=client_shell)
# for mode in ('read-only', 'degraded'): # for mode in ('read-only', 'degraded'):
for mode in ("degraded",): for mode in ("degraded",):
@ -433,13 +438,12 @@ def test_shards(prepare_wallet_and_deposit, create_container_and_pick_node, host
assert shards assert shards
with pytest.raises(RuntimeError): with pytest.raises(RuntimeError):
put_object(wallet, file_path, cid) put_object(wallet, file_path, cid, shell=client_shell)
with pytest.raises(RuntimeError): with pytest.raises(RuntimeError):
delete_object(wallet, cid, original_oid) delete_object(wallet, cid, original_oid, shell=client_shell)
# head_object(wallet, cid, original_oid) get_object(wallet, cid, original_oid, shell=client_shell)
get_object(wallet, cid, original_oid)
for shard in shards: for shard in shards:
node_shard_set_mode(hosting, node_name, shard, "read-write") node_shard_set_mode(hosting, node_name, shard, "read-write")
@ -447,8 +451,8 @@ def test_shards(prepare_wallet_and_deposit, create_container_and_pick_node, host
shards = node_shard_list(hosting, node_name) shards = node_shard_list(hosting, node_name)
assert shards assert shards
oid = put_object(wallet, file_path, cid) oid = put_object(wallet, file_path, cid, shell=client_shell)
delete_object(wallet, cid, oid) delete_object(wallet, cid, oid, shell=client_shell)
@allure.step("Validate object has {expected_copies} copies") @allure.step("Validate object has {expected_copies} copies")
@ -515,10 +519,10 @@ def wait_for_expected_object_copies(
@allure.step("Wait for object to be dropped") @allure.step("Wait for object to be dropped")
def wait_for_obj_dropped(wallet: str, cid: str, oid: str, checker) -> None: def wait_for_obj_dropped(wallet: str, cid: str, oid: str, shell: Shell, checker) -> None:
for _ in range(3): for _ in range(3):
try: try:
checker(wallet, cid, oid) checker(wallet, cid, oid, shell=shell)
wait_for_gc_pass_on_storage_nodes() wait_for_gc_pass_on_storage_nodes()
except Exception as err: except Exception as err:
if error_matches_status(err, OBJECT_NOT_FOUND): if error_matches_status(err, OBJECT_NOT_FOUND):

View file

@ -49,9 +49,7 @@ def put_storagegroup(
@allure.step("List Storagegroup") @allure.step("List Storagegroup")
def list_storagegroup( def list_storagegroup(wallet: str, cid: str, bearer: str = "", wallet_config: str = WALLET_CONFIG):
wallet: str, cid: str, bearer: str = "", wallet_config: str = WALLET_CONFIG
):
""" """
Wrapper for `neofs-cli storagegroup list`. This operation Wrapper for `neofs-cli storagegroup list`. This operation
requires SEARCH allowed for `wallet` in `cid`. requires SEARCH allowed for `wallet` in `cid`.
@ -160,9 +158,7 @@ def verify_list_storage_group(
bearer: str = None, bearer: str = None,
wallet_config: str = WALLET_CONFIG, wallet_config: str = WALLET_CONFIG,
): ):
storage_groups = list_storagegroup( storage_groups = list_storagegroup(wallet, cid, bearer=bearer, wallet_config=wallet_config)
wallet, cid, bearer=bearer, wallet_config=wallet_config
)
assert storagegroup in storage_groups assert storagegroup in storage_groups
@ -187,6 +183,7 @@ def verify_get_storage_group(
wallet, wallet,
cid, cid,
link_oid, link_oid,
shell=shell,
is_raw=True, is_raw=True,
bearer=bearer, bearer=bearer,
wallet_config=wallet_config, wallet_config=wallet_config,

View file

@ -11,8 +11,8 @@ def verify_head_tombstone(wallet_path: str, cid: str, oid_ts: str, oid: str, she
header = head_object(wallet_path, cid, oid_ts, shell=shell)["header"] header = head_object(wallet_path, cid, oid_ts, shell=shell)["header"]
assert header["containerID"] == cid, "Tombstone Header CID is wrong" assert header["containerID"] == cid, "Tombstone Header CID is wrong"
with open(wallet_path, "r") as fout: with open(wallet_path, "r") as file:
wlt_data = json.loads(fout.read()) wlt_data = json.loads(file.read())
wlt = wallet.Wallet.from_json(wlt_data, password="") wlt = wallet.Wallet.from_json(wlt_data, password="")
addr = wlt.accounts[0].address addr = wlt.accounts[0].address