From 72b4fcf182a3a276d11dc010e965f5014ff8bef9 Mon Sep 17 00:00:00 2001 From: Ekaterina Chernitsyna Date: Fri, 22 Nov 2024 16:41:24 +0300 Subject: [PATCH] [#326] add deny morph tests ape --- pytest_tests/testsuites/ape/test_ape.py | 29 ++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/pytest_tests/testsuites/ape/test_ape.py b/pytest_tests/testsuites/ape/test_ape.py index e029289e..c42e56a8 100644 --- a/pytest_tests/testsuites/ape/test_ape.py +++ b/pytest_tests/testsuites/ape/test_ape.py @@ -55,7 +55,7 @@ def local_overrides_on_node(node: ClusterNode, id_chains_for_remove: list[str]): shell: Shell = node.host.get_shell() remote_config: str = node.storage_node.get_remote_wallet_config_path() cli = FrostfsCli(shell=shell, frostfs_cli_exec_path=FROSTFS_CLI_EXEC, config_file=remote_config) - with reporter.step("Delete rules on {node.storage_node.id} node"): + with reporter.step(f"Delete rules on {node.storage_node.id} node"): for chain_id in id_chains_for_remove: cli.control.remove_rule( endpoint=node.storage_node.get_control_endpoint(), @@ -74,15 +74,22 @@ def morph_on_node(node: ClusterNode, id_chains_for_remove: list[str]): frostfs_adm_exec_path=FROSTFS_ADM_EXEC, config_file=FROSTFS_ADM_CONFIG_PATH, ) - with reporter.step("Delete rules on {node.storage_node.id} node"): - for chain_id in id_chains_for_remove: + rules = adm.morph.list_rules(target_name="kapusta", target_type="namespace").stdout + chain_ids = [i.split(" ")[2].strip() for i in rules.split("\n") if "Chain ID" in i] + need_wait = False + with reporter.step(f"Delete rules on {node.storage_node.id} node"): + for chain_id in chain_ids: + if not chain_id in id_chains_for_remove: + continue adm.morph.remove_rule( target_type="namespace", target_name="root", chain_id=chain_id, ) - with reporter.step("Wait for one block"): - time.sleep(datetime_utils.parse_time(MORPH_BLOCK_TIME)) + need_wait = True + if need_wait: + with reporter.step("Wait for one block"): + time.sleep(datetime_utils.parse_time(MORPH_BLOCK_TIME)) @pytest.fixture(scope="session") @@ -197,6 +204,9 @@ class TestApeMorphRuleChain(ClusterTestBase): chain_id=chain_id, ) + with reporter.step("Wait for one block"): + time.sleep(datetime_utils.parse_time(MORPH_BLOCK_TIME)) + with reporter.step("Check get the container property on the first node"): with expect_not_raises(): frostfs_cli.container.get(self.cluster.storage_nodes[0].get_rpc_endpoint(), cid) @@ -246,6 +256,9 @@ class TestApeMorphRuleChain(ClusterTestBase): chain_id=chain_id, ) + with reporter.step("Wait for one block"): + time.sleep(datetime_utils.parse_time(MORPH_BLOCK_TIME)) + with reporter.step("Check create a container on the first node"): with expect_not_raises(): frostfs_cli.container.create( @@ -304,6 +317,9 @@ class TestApeMorphRuleChain(ClusterTestBase): chain_id=chain_id, ) + with reporter.step("Wait for one block"): + time.sleep(datetime_utils.parse_time(MORPH_BLOCK_TIME)) + with reporter.step("Check display a list of containers on the first node"): with expect_not_raises(): frostfs_cli.container.list(rpc_endpoint=self.cluster.storage_nodes[0].get_rpc_endpoint(), ttl=1) @@ -355,6 +371,9 @@ class TestApeMorphRuleChain(ClusterTestBase): chain_id=chain_id, ) + with reporter.step("Wait for one block"): + time.sleep(datetime_utils.parse_time(MORPH_BLOCK_TIME)) + with reporter.step("Check delete first container from the first node"): with expect_not_raises(): frostfs_cli.container.delete(self.cluster.storage_nodes[0].get_rpc_endpoint(), cid, ttl=1)