forked from TrueCloudLab/frostfs-testcases
[#329] add allow local override tests ape
This commit is contained in:
parent
119afce8ae
commit
88293fa498
1 changed files with 16 additions and 14 deletions
|
@ -51,18 +51,23 @@ def remote_frostfs_cli_first_node(cluster: Cluster):
|
|||
return cli
|
||||
|
||||
|
||||
def local_overrides_on_node(node: ClusterNode, id_chains_for_remove: list[str]):
|
||||
def local_overrides_on_node(node: ClusterNode):
|
||||
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)
|
||||
rules = cli.control.list_rules(endpoint=node.storage_node.get_control_endpoint(), target_name="root", 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 id_chains_for_remove:
|
||||
for chain_id in chain_ids:
|
||||
cli.control.remove_rule(
|
||||
endpoint=node.storage_node.get_control_endpoint(),
|
||||
target_type="namespace",
|
||||
target_name="root",
|
||||
chain_id=chain_id,
|
||||
)
|
||||
need_wait = True
|
||||
if need_wait:
|
||||
with reporter.step("Wait for one block"):
|
||||
time.sleep(datetime_utils.parse_time(MORPH_BLOCK_TIME))
|
||||
|
||||
|
@ -94,10 +99,9 @@ def morph_on_node(node: ClusterNode, id_chains_for_remove: list[str]):
|
|||
|
||||
@pytest.fixture(scope="session")
|
||||
def remove_rule_ape_in_local_override(cluster: Cluster) -> None:
|
||||
id_chains_for_remove = []
|
||||
yield id_chains_for_remove
|
||||
yield
|
||||
with reporter.step("Check local overrides on nodes."):
|
||||
parallel(local_overrides_on_node, cluster.cluster_nodes, id_chains_for_remove)
|
||||
parallel(local_overrides_on_node, cluster.cluster_nodes)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
|
@ -1084,9 +1088,6 @@ class TestApeLocalOverride(ClusterTestBase):
|
|||
frostfs_cli: FrostfsCli,
|
||||
remove_rule_ape_in_local_override: None,
|
||||
):
|
||||
chain_id = "denyContainerGet"
|
||||
remove_rule_ape_in_local_override.append(chain_id)
|
||||
|
||||
with reporter.step("Create a container on the first node"):
|
||||
cid = (
|
||||
frostfs_cli.container.create(
|
||||
|
@ -1106,7 +1107,7 @@ class TestApeLocalOverride(ClusterTestBase):
|
|||
endpoint=self.cluster.storage_nodes[0].get_control_endpoint(),
|
||||
target_type="namespace",
|
||||
target_name="root",
|
||||
chain_id=chain_id,
|
||||
chain_id="denyContainerGet",
|
||||
rule="deny Container.Get *",
|
||||
)
|
||||
|
||||
|
@ -1118,12 +1119,12 @@ class TestApeLocalOverride(ClusterTestBase):
|
|||
with expect_not_raises():
|
||||
frostfs_cli.container.get(self.cluster.storage_nodes[1].get_rpc_endpoint(), cid)
|
||||
|
||||
with reporter.step("Delete a rule"):
|
||||
"""with reporter.step("Delete a rule"):
|
||||
remote_frostfs_cli_first_node.control.remove_rule(
|
||||
endpoint=self.cluster.storage_nodes[0].get_control_endpoint(),
|
||||
target_type="namespace",
|
||||
target_name="root",
|
||||
chain_id=chain_id,
|
||||
chain_id="denyContainerGet",
|
||||
)
|
||||
|
||||
with reporter.step("Wait for one block"):
|
||||
|
@ -1132,6 +1133,7 @@ class TestApeLocalOverride(ClusterTestBase):
|
|||
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)
|
||||
"""
|
||||
|
||||
@allure.title("LocalOverride: Deny to PutContainer in root tenant")
|
||||
def test_local_override_deny_to_put_container_root(
|
||||
|
|
Loading…
Add table
Reference in a new issue