Mark replication test as failover and add fixture to return nodes

This commit is contained in:
Andrey Berezin 2023-07-31 12:27:12 +03:00
parent 63c4ac5ac6
commit 05b5f7d133

View file

@ -8,6 +8,7 @@ from frostfs_testlib.shell import Shell
from frostfs_testlib.steps.cli.container import create_container, delete_container from frostfs_testlib.steps.cli.container import create_container, delete_container
from frostfs_testlib.steps.cli.object import delete_object, head_object, put_object from frostfs_testlib.steps.cli.object import delete_object, head_object, put_object
from frostfs_testlib.storage.cluster import Cluster from frostfs_testlib.storage.cluster import Cluster
from frostfs_testlib.storage.controllers.cluster_state_controller import ClusterStateController
from frostfs_testlib.testing.cluster_test_base import ClusterTestBase from frostfs_testlib.testing.cluster_test_base import ClusterTestBase
from frostfs_testlib.utils.file_utils import generate_file from frostfs_testlib.utils.file_utils import generate_file
@ -16,9 +17,15 @@ logger = logging.getLogger("NeoLogger")
OBJECT_ATTRIBUTES = {"common_key": "common_value"} OBJECT_ATTRIBUTES = {"common_key": "common_value"}
WAIT_FOR_REPLICATION = 60 WAIT_FOR_REPLICATION = 60
# Adding failover mark because it may make cluster unhealthy
@pytest.mark.failover
@pytest.mark.replication @pytest.mark.replication
class TestReplication(ClusterTestBase): class TestReplication(ClusterTestBase):
@pytest.fixture(autouse=True)
def start_stopped_nodes_after_test(self, cluster_state_controller: ClusterStateController):
yield
cluster_state_controller.start_stopped_hosts()
@pytest.mark.parametrize( @pytest.mark.parametrize(
"object_size", "object_size",
[pytest.lazy_fixture("simple_object_size"), pytest.lazy_fixture("complex_object_size")], [pytest.lazy_fixture("simple_object_size"), pytest.lazy_fixture("complex_object_size")],
@ -31,7 +38,7 @@ class TestReplication(ClusterTestBase):
client_shell: Shell, client_shell: Shell,
cluster: Cluster, cluster: Cluster,
object_size, object_size,
cluster_state_controller, cluster_state_controller: ClusterStateController,
): ):
nodes_count = len(cluster.cluster_nodes) nodes_count = len(cluster.cluster_nodes)
node_for_rep = random.choice(cluster.cluster_nodes) node_for_rep = random.choice(cluster.cluster_nodes)
@ -88,6 +95,7 @@ class TestReplication(ClusterTestBase):
) )
with allure.step("Cleanup"): with allure.step("Cleanup"):
delete_object( delete_object(
wallet=default_wallet,
cid=cid, cid=cid,
oid=oid, oid=oid,
shell=client_shell, shell=client_shell,
@ -95,6 +103,7 @@ class TestReplication(ClusterTestBase):
) )
delete_container( delete_container(
wallet=default_wallet,
cid=cid, cid=cid,
shell=client_shell, shell=client_shell,
endpoint=cluster.default_rpc_endpoint, endpoint=cluster.default_rpc_endpoint,