[#298] Add set mode shards in teardown test ec

Signed-off-by: Dmitriy Zayakin <d.zayakin@yadro.com>
This commit is contained in:
Dmitriy Zayakin 2024-09-03 17:52:33 +03:00 committed by Dmitriy Zayakin
parent 9528ff0333
commit 8234a0ece2

View file

@ -1,7 +1,10 @@
import json
from dataclasses import dataclass
import time
import allure
from frostfs_testlib.shell.interfaces import Shell
from frostfs_testlib.utils import datetime_utils
import pytest
import yaml
from frostfs_testlib import plugins, reporter
@ -9,7 +12,7 @@ from frostfs_testlib.cli import FrostfsAdm, FrostfsCli
from frostfs_testlib.cli.netmap_parser import NetmapParser
from frostfs_testlib.credentials.interfaces import User
from frostfs_testlib.resources.cli import CLI_DEFAULT_TIMEOUT, FROSTFS_ADM_CONFIG_PATH, FROSTFS_ADM_EXEC, FROSTFS_CLI_EXEC
from frostfs_testlib.resources.common import COMPLEX_OBJECT_CHUNKS_COUNT, COMPLEX_OBJECT_TAIL_SIZE, HOSTING_CONFIG_FILE
from frostfs_testlib.resources.common import COMPLEX_OBJECT_CHUNKS_COUNT, COMPLEX_OBJECT_TAIL_SIZE, HOSTING_CONFIG_FILE, MORPH_BLOCK_TIME
from frostfs_testlib.s3 import AwsCliClient, S3ClientWrapper
from frostfs_testlib.s3.interfaces import BucketContainerResolver, VersioningStatus
from frostfs_testlib.steps.cli.object import get_object, put_object
@ -67,6 +70,21 @@ def frostfs_remote_adm(cluster: Cluster) -> FrostfsAdm:
@pytest.mark.replication
@pytest.mark.ec_replication
class TestECReplication(ClusterTestBase):
def get_node_cli(self, cluster_node: ClusterNode, config: str) -> FrostfsCli:
shell = cluster_node.host.get_shell()
cli = FrostfsCli(shell, frostfs_cli_exec_path=FROSTFS_CLI_EXEC, config_file=config)
self.cli_change_shards_mode: dict[FrostfsCli, str] = {cli: cluster_node.storage_node.get_control_endpoint()}
return cli
@pytest.fixture()
def restore_nodes_shards_mode(self):
yield
for cli, endpoint in self.cli_change_shards_mode.items():
cli.shards.set_mode(endpoint, mode='read-write', all=True)
time.sleep(datetime_utils.parse_time(MORPH_BLOCK_TIME))
@pytest.fixture()
def rep_count(self, object_size: ObjectSize) -> int:
rep_count = 3
@ -777,6 +795,7 @@ class TestECReplication(ClusterTestBase):
@pytest.mark.parametrize("type, get_chunk", [("data", get_data_chunk_object), ("parity", get_parity_chunk_object)])
def test_evacuation_data_shard(
self,
restore_nodes_shards_mode: None,
default_user: User,
frostfs_cli: FrostfsCli,
max_object_size: int,
@ -793,10 +812,9 @@ class TestECReplication(ClusterTestBase):
with reporter.step("Get object chunks."):
chunk = get_chunk(self, frostfs_cli, cid, oid, self.cluster.default_rpc_endpoint)
chunk_node = self.get_chunk_node(frostfs_cli, chunk)
frostfs_node_cli = FrostfsCli(
chunk_node[0].host.get_shell(),
frostfs_cli_exec_path=FROSTFS_CLI_EXEC,
config_file=chunk_node[0].storage_node.get_remote_wallet_config_path(),
frostfs_node_cli = self.get_node_cli(
chunk_node[0],
config=chunk_node[0].storage_node.get_remote_wallet_config_path(),
)
with reporter.step("Search shards chunk"):