forked from TrueCloudLab/frostfs-testcases
Delete non actual policy test
Signed-off-by: Dmitriy Zayakin <d.zayakin@yadro.com>
This commit is contained in:
parent
6749245206
commit
e7e963b1a1
1 changed files with 0 additions and 134 deletions
|
@ -203,97 +203,6 @@ class TestNodeManagement(ClusterTestBase):
|
||||||
)
|
)
|
||||||
wait_object_replication(cid, oid, 4, shell=self.shell, nodes=storage_nodes)
|
wait_object_replication(cid, oid, 4, shell=self.shell, nodes=storage_nodes)
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
"placement_rule,expected_copies",
|
|
||||||
[
|
|
||||||
("REP 2 IN X CBF 2 SELECT 2 FROM * AS X", 2),
|
|
||||||
("REP 2 IN X CBF 1 SELECT 2 FROM * AS X", 2),
|
|
||||||
("REP 3 IN X CBF 1 SELECT 3 FROM * AS X", 3),
|
|
||||||
("REP 1 IN X CBF 1 SELECT 1 FROM * AS X", 1),
|
|
||||||
("REP 1 IN X CBF 2 SELECT 1 FROM * AS X", 1),
|
|
||||||
("REP 4 IN X CBF 1 SELECT 4 FROM * AS X", 4),
|
|
||||||
("REP 2 IN X CBF 1 SELECT 4 FROM * AS X", 2),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
@pytest.mark.node_mgmt
|
|
||||||
@allure.title("Placement policy (copies={expected_copies}, policy={placement_rule})")
|
|
||||||
def test_placement_policy(self, default_wallet, placement_rule, expected_copies, simple_object_size: ObjectSize):
|
|
||||||
"""
|
|
||||||
This test checks object's copies based on container's placement policy.
|
|
||||||
"""
|
|
||||||
wallet = default_wallet
|
|
||||||
file_path = generate_file(simple_object_size.value)
|
|
||||||
self.validate_object_copies(wallet, placement_rule, file_path, expected_copies)
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
"placement_rule,expected_copies,expected_nodes_id",
|
|
||||||
[
|
|
||||||
("REP 4 IN X CBF 1 SELECT 4 FROM * AS X", 4, {1, 2, 3, 4}),
|
|
||||||
(
|
|
||||||
"REP 1 IN LOC_PLACE CBF 1 SELECT 1 FROM LOC_SW AS LOC_PLACE FILTER Country EQ Sweden AS LOC_SW",
|
|
||||||
1,
|
|
||||||
{3},
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"REP 1 IN SEL_SPB CBF 1 SELECT 1 FROM LOC_SPB AS SEL_SPB FILTER 'UN-LOCODE' EQ 'RU LED' AS LOC_SPB",
|
|
||||||
1,
|
|
||||||
{2},
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"REP 1 IN LOC_SPB_PLACE REP 1 IN LOC_MSK_PLACE CBF 1 SELECT 1 FROM LOC_SPB AS LOC_SPB_PLACE "
|
|
||||||
"SELECT 1 FROM LOC_MSK AS LOC_MSK_PLACE "
|
|
||||||
"FILTER 'UN-LOCODE' EQ 'RU LED' AS LOC_SPB FILTER 'UN-LOCODE' EQ 'RU MOW' AS LOC_MSK",
|
|
||||||
2,
|
|
||||||
{1, 2},
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"REP 4 CBF 1 SELECT 4 FROM LOC_EU FILTER Continent EQ Europe AS LOC_EU",
|
|
||||||
4,
|
|
||||||
{1, 2, 3, 4},
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"REP 1 IN SEL_SPB CBF 1 SELECT 1 FROM LOC_SPB AS SEL_SPB "
|
|
||||||
"FILTER 'UN-LOCODE' NE 'RU MOW' AND 'UN-LOCODE' NE 'SE STO' AND 'UN-LOCODE' NE 'FI HEL' AS LOC_SPB",
|
|
||||||
1,
|
|
||||||
{2},
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"REP 2 IN SEL CBF 1 SELECT 2 FROM LOC_RU AS SEL FILTER SubDivCode NE 'AB' AND SubDivCode NE '18' AS LOC_RU",
|
|
||||||
2,
|
|
||||||
{1, 2},
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"REP 2 IN SEL_EU CBF 1 SELECT 2 FROM LOC_RU AS SEL_EU FILTER Country EQ 'Russia' AS LOC_RU",
|
|
||||||
2,
|
|
||||||
{1, 2},
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"REP 2 IN SEL_EU CBF 1 SELECT 2 FROM LOC_EU AS SEL_EU FILTER Country NE 'Russia' AS LOC_EU",
|
|
||||||
2,
|
|
||||||
{3, 4},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
@pytest.mark.node_mgmt
|
|
||||||
@allure.title("Placement policy (nodes_id={expected_nodes_id}, policy={placement_rule})")
|
|
||||||
def test_placement_policy_with_nodes(
|
|
||||||
self,
|
|
||||||
default_wallet,
|
|
||||||
placement_rule,
|
|
||||||
expected_copies,
|
|
||||||
expected_nodes_id: set[int],
|
|
||||||
simple_object_size: ObjectSize,
|
|
||||||
):
|
|
||||||
"""
|
|
||||||
Based on container's placement policy check that storage nodes are piked correctly and object has
|
|
||||||
correct copies amount.
|
|
||||||
"""
|
|
||||||
wallet = default_wallet
|
|
||||||
file_path = generate_file(simple_object_size.value)
|
|
||||||
cid, oid, found_nodes = self.validate_object_copies(wallet, placement_rule, file_path, expected_copies)
|
|
||||||
|
|
||||||
assert found_nodes == expected_nodes_id, f"Expected nodes {expected_nodes_id}, got {found_nodes}"
|
|
||||||
|
|
||||||
@pytest.mark.node_mgmt
|
@pytest.mark.node_mgmt
|
||||||
@allure.title("Drop object using control command")
|
@allure.title("Drop object using control command")
|
||||||
def test_drop_object(self, default_wallet, complex_object_size: ObjectSize, simple_object_size: ObjectSize):
|
def test_drop_object(self, default_wallet, complex_object_size: ObjectSize, simple_object_size: ObjectSize):
|
||||||
|
@ -401,49 +310,6 @@ class TestNodeManagement(ClusterTestBase):
|
||||||
)
|
)
|
||||||
self.return_nodes(alive_node)
|
self.return_nodes(alive_node)
|
||||||
|
|
||||||
@allure.step("Validate object has {expected_copies} copies")
|
|
||||||
def validate_object_copies(
|
|
||||||
self, wallet: str, placement_rule: str, file_path: str, expected_copies: int
|
|
||||||
) -> set[int]:
|
|
||||||
endpoint = self.cluster.default_rpc_endpoint
|
|
||||||
cid = create_container(wallet, rule=placement_rule, basic_acl=PUBLIC_ACL, shell=self.shell, endpoint=endpoint)
|
|
||||||
got_policy = placement_policy_from_container(
|
|
||||||
get_container(wallet, cid, json_mode=False, shell=self.shell, endpoint=endpoint)
|
|
||||||
)
|
|
||||||
assert got_policy.replace("'", "") == placement_rule.replace(
|
|
||||||
"'", ""
|
|
||||||
), f"Expected \n{placement_rule} and got policy \n{got_policy} are the same"
|
|
||||||
oid = put_object_to_random_node(wallet, file_path, cid, shell=self.shell, cluster=self.cluster)
|
|
||||||
nodes = get_nodes_with_object(cid, oid, shell=self.shell, nodes=self.cluster.storage_nodes)
|
|
||||||
nodes_id = {node.id for node in nodes}
|
|
||||||
assert len(nodes) == expected_copies, f"Expected {expected_copies} copies, got {len(nodes)}"
|
|
||||||
return cid, oid, nodes_id
|
|
||||||
|
|
||||||
@allure.step("Wait for node {node} goes online")
|
|
||||||
def wait_for_node_go_online(self, node: StorageNode) -> None:
|
|
||||||
timeout, attempts = 5, 20
|
|
||||||
for _ in range(attempts):
|
|
||||||
try:
|
|
||||||
health_check = storage_node_healthcheck(node)
|
|
||||||
assert health_check.health_status == "READY" and health_check.network_status == "ONLINE"
|
|
||||||
return
|
|
||||||
except Exception as err:
|
|
||||||
logger.warning(f"Node {node} is not online:\n{err}")
|
|
||||||
sleep(timeout)
|
|
||||||
raise AssertionError(f"Node {node} hasn't gone to the READY and ONLINE state after {timeout * attempts} second")
|
|
||||||
|
|
||||||
@allure.step("Wait for {expected_copies} object copies in the wallet")
|
|
||||||
def wait_for_expected_object_copies(self, wallet: str, cid: str, oid: str, expected_copies: int = 2) -> None:
|
|
||||||
nodes = self.cluster.storage_nodes
|
|
||||||
for _ in range(2):
|
|
||||||
copies = get_simple_object_copies(wallet, cid, oid, self.shell, nodes)
|
|
||||||
if copies == expected_copies:
|
|
||||||
break
|
|
||||||
tick_epoch(self.shell, self.cluster)
|
|
||||||
sleep(datetime_utils.parse_time(FROSTFS_CONTRACT_CACHE_TIMEOUT))
|
|
||||||
else:
|
|
||||||
raise AssertionError(f"There are no {expected_copies} copies during time")
|
|
||||||
|
|
||||||
@allure.step("Wait for object to be dropped")
|
@allure.step("Wait for object to be dropped")
|
||||||
def wait_for_obj_dropped(self, wallet: str, cid: str, oid: str, endpoint: str, checker) -> None:
|
def wait_for_obj_dropped(self, wallet: str, cid: str, oid: str, endpoint: str, checker) -> None:
|
||||||
for _ in range(3):
|
for _ in range(3):
|
||||||
|
|
Loading…
Reference in a new issue