[#278] Fix teardown network tests
Some checks reported warnings
DCO check / Commits Check (pull_request) Has been cancelled
Some checks reported warnings
DCO check / Commits Check (pull_request) Has been cancelled
Signed-off-by: Dmitriy Zayakin <d.zayakin@yadro.com>
This commit is contained in:
parent
1f43aa4dc0
commit
e35df1b578
1 changed files with 7 additions and 39 deletions
|
@ -1,5 +1,4 @@
|
||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
import random
|
import random
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
|
@ -9,13 +8,7 @@ from frostfs_testlib import reporter
|
||||||
from frostfs_testlib.healthcheck.interfaces import Healthcheck
|
from frostfs_testlib.healthcheck.interfaces import Healthcheck
|
||||||
from frostfs_testlib.resources.wellknown_acl import EACL_PUBLIC_READ_WRITE, PUBLIC_ACL
|
from frostfs_testlib.resources.wellknown_acl import EACL_PUBLIC_READ_WRITE, PUBLIC_ACL
|
||||||
from frostfs_testlib.steps.cli.container import create_container
|
from frostfs_testlib.steps.cli.container import create_container
|
||||||
from frostfs_testlib.steps.cli.object import (
|
from frostfs_testlib.steps.cli.object import get_object, get_object_nodes, neo_go_query_height, put_object, put_object_to_random_node
|
||||||
get_object,
|
|
||||||
get_object_nodes,
|
|
||||||
neo_go_query_height,
|
|
||||||
put_object,
|
|
||||||
put_object_to_random_node,
|
|
||||||
)
|
|
||||||
from frostfs_testlib.steps.storage_object import delete_objects
|
from frostfs_testlib.steps.storage_object import delete_objects
|
||||||
from frostfs_testlib.storage.cluster import ClusterNode
|
from frostfs_testlib.storage.cluster import ClusterNode
|
||||||
from frostfs_testlib.storage.controllers import ClusterStateController
|
from frostfs_testlib.storage.controllers import ClusterStateController
|
||||||
|
@ -32,7 +25,6 @@ STORAGE_NODE_COMMUNICATION_PORT = "8080"
|
||||||
STORAGE_NODE_COMMUNICATION_PORT_TLS = "8082"
|
STORAGE_NODE_COMMUNICATION_PORT_TLS = "8082"
|
||||||
PORTS_TO_BLOCK = [STORAGE_NODE_COMMUNICATION_PORT, STORAGE_NODE_COMMUNICATION_PORT_TLS]
|
PORTS_TO_BLOCK = [STORAGE_NODE_COMMUNICATION_PORT, STORAGE_NODE_COMMUNICATION_PORT_TLS]
|
||||||
blocked_nodes: list[ClusterNode] = []
|
blocked_nodes: list[ClusterNode] = []
|
||||||
file_wait_delete = []
|
|
||||||
|
|
||||||
OBJECT_ATTRIBUTES = [
|
OBJECT_ATTRIBUTES = [
|
||||||
None,
|
None,
|
||||||
|
@ -63,14 +55,6 @@ class TestFailoverNetwork(ClusterTestBase):
|
||||||
yield
|
yield
|
||||||
cluster_state_controller.restore_interfaces()
|
cluster_state_controller.restore_interfaces()
|
||||||
|
|
||||||
@pytest.fixture()
|
|
||||||
@allure.title("Delete file after test")
|
|
||||||
def delete_file_after_test(self) -> None:
|
|
||||||
yield
|
|
||||||
for path in file_wait_delete:
|
|
||||||
os.remove(path)
|
|
||||||
file_wait_delete.clear()
|
|
||||||
|
|
||||||
@pytest.fixture()
|
@pytest.fixture()
|
||||||
def storage_objects(
|
def storage_objects(
|
||||||
self,
|
self,
|
||||||
|
@ -113,9 +97,7 @@ class TestFailoverNetwork(ClusterTestBase):
|
||||||
|
|
||||||
storage_objects.append(storage_object)
|
storage_objects.append(storage_object)
|
||||||
|
|
||||||
yield storage_objects
|
return storage_objects
|
||||||
|
|
||||||
delete_objects(storage_objects, self.shell, self.cluster)
|
|
||||||
|
|
||||||
@allure.title("Block Storage node traffic")
|
@allure.title("Block Storage node traffic")
|
||||||
def test_block_storage_node_traffic(
|
def test_block_storage_node_traffic(
|
||||||
|
@ -174,9 +156,7 @@ class TestFailoverNetwork(ClusterTestBase):
|
||||||
assert node.storage_node not in new_nodes
|
assert node.storage_node not in new_nodes
|
||||||
|
|
||||||
with reporter.step("Check object data is not corrupted"):
|
with reporter.step("Check object data is not corrupted"):
|
||||||
got_file_path = get_object(
|
got_file_path = get_object(wallet, cid, oid, endpoint=new_nodes[0].get_rpc_endpoint(), shell=self.shell)
|
||||||
wallet, cid, oid, endpoint=new_nodes[0].get_rpc_endpoint(), shell=self.shell
|
|
||||||
)
|
|
||||||
assert get_file_hash(source_file_path) == get_file_hash(got_file_path)
|
assert get_file_hash(source_file_path) == get_file_hash(got_file_path)
|
||||||
|
|
||||||
with reporter.step(f"Unblock incoming traffic"):
|
with reporter.step(f"Unblock incoming traffic"):
|
||||||
|
@ -184,9 +164,7 @@ class TestFailoverNetwork(ClusterTestBase):
|
||||||
with reporter.step(f"Unblock at host {node}"):
|
with reporter.step(f"Unblock at host {node}"):
|
||||||
cluster_state_controller.restore_traffic(node=node)
|
cluster_state_controller.restore_traffic(node=node)
|
||||||
block_node = [
|
block_node = [
|
||||||
cluster_node
|
cluster_node for cluster_node in self.cluster.cluster_nodes if cluster_node.storage_node == node.storage_node
|
||||||
for cluster_node in self.cluster.cluster_nodes
|
|
||||||
if cluster_node.storage_node == node.storage_node
|
|
||||||
]
|
]
|
||||||
blocked_nodes.remove(*block_node)
|
blocked_nodes.remove(*block_node)
|
||||||
sleep(wakeup_node_timeout)
|
sleep(wakeup_node_timeout)
|
||||||
|
@ -204,7 +182,6 @@ class TestFailoverNetwork(ClusterTestBase):
|
||||||
cluster_state_controller: ClusterStateController,
|
cluster_state_controller: ClusterStateController,
|
||||||
default_wallet: WalletInfo,
|
default_wallet: WalletInfo,
|
||||||
restore_down_interfaces: None,
|
restore_down_interfaces: None,
|
||||||
delete_file_after_test: None,
|
|
||||||
storage_objects: list[StorageObjectInfo],
|
storage_objects: list[StorageObjectInfo],
|
||||||
):
|
):
|
||||||
storage_object = storage_objects[0]
|
storage_object = storage_objects[0]
|
||||||
|
@ -248,7 +225,6 @@ class TestFailoverNetwork(ClusterTestBase):
|
||||||
shell=self.shell,
|
shell=self.shell,
|
||||||
endpoint=nodes_without_an_object[0].storage_node.get_rpc_endpoint(),
|
endpoint=nodes_without_an_object[0].storage_node.get_rpc_endpoint(),
|
||||||
)
|
)
|
||||||
file_wait_delete.append(input_file)
|
|
||||||
|
|
||||||
with reporter.step("Restore interface and tick 1 epoch, wait 2 block"):
|
with reporter.step("Restore interface and tick 1 epoch, wait 2 block"):
|
||||||
cluster_state_controller.restore_interfaces()
|
cluster_state_controller.restore_interfaces()
|
||||||
|
@ -261,7 +237,6 @@ class TestFailoverNetwork(ClusterTestBase):
|
||||||
cluster_state_controller: ClusterStateController,
|
cluster_state_controller: ClusterStateController,
|
||||||
default_wallet: WalletInfo,
|
default_wallet: WalletInfo,
|
||||||
restore_down_interfaces: None,
|
restore_down_interfaces: None,
|
||||||
delete_file_after_test: None,
|
|
||||||
storage_objects: list[StorageObjectInfo],
|
storage_objects: list[StorageObjectInfo],
|
||||||
simple_object_size: ObjectSize,
|
simple_object_size: ObjectSize,
|
||||||
):
|
):
|
||||||
|
@ -289,7 +264,7 @@ class TestFailoverNetwork(ClusterTestBase):
|
||||||
self.tick_epochs(1, alive_node=nodes_without_an_object[0].storage_node, wait_block=2)
|
self.tick_epochs(1, alive_node=nodes_without_an_object[0].storage_node, wait_block=2)
|
||||||
|
|
||||||
with reporter.step("Get object others node, expect false"):
|
with reporter.step("Get object others node, expect false"):
|
||||||
with pytest.raises(RuntimeError, match="return code: 1"):
|
with pytest.raises(RuntimeError, match="rpc error"):
|
||||||
get_object(
|
get_object(
|
||||||
wallet=default_wallet,
|
wallet=default_wallet,
|
||||||
cid=storage_object.cid,
|
cid=storage_object.cid,
|
||||||
|
@ -299,7 +274,7 @@ class TestFailoverNetwork(ClusterTestBase):
|
||||||
)
|
)
|
||||||
|
|
||||||
with reporter.step("Put object, others node, expect false"):
|
with reporter.step("Put object, others node, expect false"):
|
||||||
with pytest.raises(RuntimeError, match="return code: 1"):
|
with pytest.raises(RuntimeError, match="rpc error"):
|
||||||
put_object(
|
put_object(
|
||||||
wallet=default_wallet,
|
wallet=default_wallet,
|
||||||
path=storage_object.file_path,
|
path=storage_object.file_path,
|
||||||
|
@ -316,7 +291,6 @@ class TestFailoverNetwork(ClusterTestBase):
|
||||||
shell=self.shell,
|
shell=self.shell,
|
||||||
endpoint=nodes_with_object[0].storage_node.get_rpc_endpoint(),
|
endpoint=nodes_with_object[0].storage_node.get_rpc_endpoint(),
|
||||||
)
|
)
|
||||||
file_wait_delete.append(input_file)
|
|
||||||
|
|
||||||
with reporter.step(f"Put object nodes with object, expect true"):
|
with reporter.step(f"Put object nodes with object, expect true"):
|
||||||
temp_file_path = generate_file(simple_object_size.value)
|
temp_file_path = generate_file(simple_object_size.value)
|
||||||
|
@ -327,7 +301,7 @@ class TestFailoverNetwork(ClusterTestBase):
|
||||||
shell=self.shell,
|
shell=self.shell,
|
||||||
endpoint=nodes_with_object[0].storage_node.get_rpc_endpoint(),
|
endpoint=nodes_with_object[0].storage_node.get_rpc_endpoint(),
|
||||||
)
|
)
|
||||||
file_wait_delete.append(temp_file_path)
|
|
||||||
with reporter.step("Restore interface and tick 1 epoch, wait 2 block"):
|
with reporter.step("Restore interface and tick 1 epoch, wait 2 block"):
|
||||||
cluster_state_controller.restore_interfaces()
|
cluster_state_controller.restore_interfaces()
|
||||||
self.tick_epochs(1, alive_node=nodes_without_an_object[0].storage_node, wait_block=2)
|
self.tick_epochs(1, alive_node=nodes_without_an_object[0].storage_node, wait_block=2)
|
||||||
|
@ -345,7 +319,6 @@ class TestFailoverNetwork(ClusterTestBase):
|
||||||
cluster_state_controller: ClusterStateController,
|
cluster_state_controller: ClusterStateController,
|
||||||
default_wallet: WalletInfo,
|
default_wallet: WalletInfo,
|
||||||
simple_object_size: ObjectSize,
|
simple_object_size: ObjectSize,
|
||||||
delete_file_after_test: None,
|
|
||||||
restore_down_interfaces: None,
|
restore_down_interfaces: None,
|
||||||
block_interface: Interfaces,
|
block_interface: Interfaces,
|
||||||
other_interface: Interfaces,
|
other_interface: Interfaces,
|
||||||
|
@ -367,7 +340,6 @@ class TestFailoverNetwork(ClusterTestBase):
|
||||||
|
|
||||||
with reporter.step("Put object"):
|
with reporter.step("Put object"):
|
||||||
file_path = generate_file(simple_object_size.value)
|
file_path = generate_file(simple_object_size.value)
|
||||||
file_wait_delete.append(file_path)
|
|
||||||
|
|
||||||
oid = put_object(
|
oid = put_object(
|
||||||
wallet=default_wallet,
|
wallet=default_wallet,
|
||||||
|
@ -385,7 +357,6 @@ class TestFailoverNetwork(ClusterTestBase):
|
||||||
shell=self.shell,
|
shell=self.shell,
|
||||||
endpoint=f"{cluster_nodes[0].get_data_interface(other_interface.value)[0]}:8080",
|
endpoint=f"{cluster_nodes[0].get_data_interface(other_interface.value)[0]}:8080",
|
||||||
)
|
)
|
||||||
file_wait_delete.append(file_get_path)
|
|
||||||
|
|
||||||
with reporter.step("Restore interfaces all nodes"):
|
with reporter.step("Restore interfaces all nodes"):
|
||||||
cluster_state_controller.restore_interfaces()
|
cluster_state_controller.restore_interfaces()
|
||||||
|
@ -401,7 +372,6 @@ class TestFailoverNetwork(ClusterTestBase):
|
||||||
cluster_state_controller: ClusterStateController,
|
cluster_state_controller: ClusterStateController,
|
||||||
default_wallet: WalletInfo,
|
default_wallet: WalletInfo,
|
||||||
simple_object_size: ObjectSize,
|
simple_object_size: ObjectSize,
|
||||||
delete_file_after_test: None,
|
|
||||||
restore_down_interfaces: None,
|
restore_down_interfaces: None,
|
||||||
interface: Interfaces,
|
interface: Interfaces,
|
||||||
):
|
):
|
||||||
|
@ -430,7 +400,6 @@ class TestFailoverNetwork(ClusterTestBase):
|
||||||
|
|
||||||
with reporter.step(f"Put object, after down {interface}"):
|
with reporter.step(f"Put object, after down {interface}"):
|
||||||
file_path = generate_file(simple_object_size.value)
|
file_path = generate_file(simple_object_size.value)
|
||||||
file_wait_delete.append(file_path)
|
|
||||||
|
|
||||||
oid = put_object(
|
oid = put_object(
|
||||||
wallet=default_wallet,
|
wallet=default_wallet,
|
||||||
|
@ -448,7 +417,6 @@ class TestFailoverNetwork(ClusterTestBase):
|
||||||
shell=self.shell,
|
shell=self.shell,
|
||||||
endpoint=self.cluster.default_rpc_endpoint,
|
endpoint=self.cluster.default_rpc_endpoint,
|
||||||
)
|
)
|
||||||
file_wait_delete.append(file_get_path)
|
|
||||||
|
|
||||||
now_block = {}
|
now_block = {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue