[#157] fix for dev-env and unit-tests

Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
Andrey Berezin 2024-01-12 18:23:04 +03:00 committed by Andrey Berezin
parent df8d99d83c
commit be36a10f1e
4 changed files with 19 additions and 27 deletions

View file

@ -152,9 +152,7 @@ class DockerHost(Host):
timeout=service_attributes.start_timeout, timeout=service_attributes.start_timeout,
) )
def wait_for_service_to_be_in_state( def wait_for_service_to_be_in_state(self, systemd_service_name: str, expected_state: str, timeout: int) -> None:
self, systemd_service_name: str, expected_state: str, timeout: int
) -> None:
raise NotImplementedError("Not implemented for docker") raise NotImplementedError("Not implemented for docker")
def get_data_directory(self, service_name: str) -> str: def get_data_directory(self, service_name: str) -> str:
@ -181,6 +179,12 @@ class DockerHost(Host):
def delete_pilorama(self, service_name: str) -> None: def delete_pilorama(self, service_name: str) -> None:
raise NotImplementedError("Not implemented for docker") raise NotImplementedError("Not implemented for docker")
def delete_file(self, file_path: str) -> None:
raise NotImplementedError("Not implemented for docker")
def is_file_exist(self, file_path: str) -> None:
raise NotImplementedError("Not implemented for docker")
def delete_storage_node_data(self, service_name: str, cache_only: bool = False) -> None: def delete_storage_node_data(self, service_name: str, cache_only: bool = False) -> None:
volume_path = self.get_data_directory(service_name) volume_path = self.get_data_directory(service_name)
@ -305,9 +309,7 @@ class DockerHost(Host):
return container return container
return None return None
def _wait_for_container_to_be_in_state( def _wait_for_container_to_be_in_state(self, container_name: str, expected_state: str, timeout: int) -> None:
self, container_name: str, expected_state: str, timeout: int
) -> None:
iterations = 10 iterations = 10
iteration_wait_time = timeout / iterations iteration_wait_time = timeout / iterations

View file

@ -87,7 +87,7 @@ def tick_epoch(shell: Shell, cluster: Cluster, alive_node: Optional[StorageNode]
alive_node = alive_node if alive_node else cluster.services(StorageNode)[0] alive_node = alive_node if alive_node else cluster.services(StorageNode)[0]
remote_shell = alive_node.host.get_shell() remote_shell = alive_node.host.get_shell()
if FROSTFS_ADM_EXEC and FROSTFS_ADM_CONFIG_PATH: if "force_transactions" not in alive_node.host.config.attributes:
# If frostfs-adm is available, then we tick epoch with it (to be consistent with UAT tests) # If frostfs-adm is available, then we tick epoch with it (to be consistent with UAT tests)
frostfs_adm = FrostfsAdm( frostfs_adm = FrostfsAdm(
shell=remote_shell, shell=remote_shell,

View file

@ -4,13 +4,7 @@ import pytest
from frostfs_testlib.s3 import AwsCliClient, Boto3ClientWrapper from frostfs_testlib.s3 import AwsCliClient, Boto3ClientWrapper
from frostfs_testlib.storage.dataclasses.acl import EACLRole from frostfs_testlib.storage.dataclasses.acl import EACLRole
from frostfs_testlib.storage.dataclasses.frostfs_services import ( from frostfs_testlib.storage.dataclasses.frostfs_services import HTTPGate, InnerRing, MorphChain, S3Gate, StorageNode
HTTPGate,
InnerRing,
MorphChain,
S3Gate,
StorageNode,
)
from frostfs_testlib.storage.dataclasses.object_size import ObjectSize from frostfs_testlib.storage.dataclasses.object_size import ObjectSize
@ -22,10 +16,10 @@ class TestDataclassesStr:
[ [
(Boto3ClientWrapper, "Boto3 client"), (Boto3ClientWrapper, "Boto3 client"),
(AwsCliClient, "AWS CLI"), (AwsCliClient, "AWS CLI"),
(ObjectSize("simple", 1), "simple object size"), (ObjectSize("simple", 1), "simple"),
(ObjectSize("simple", 10), "simple object size"), (ObjectSize("simple", 10), "simple"),
(ObjectSize("complex", 5000), "complex object size"), (ObjectSize("complex", 5000), "complex"),
(ObjectSize("complex", 5555), "complex object size"), (ObjectSize("complex", 5555), "complex"),
(StorageNode, "StorageNode"), (StorageNode, "StorageNode"),
(MorphChain, "MorphChain"), (MorphChain, "MorphChain"),
(S3Gate, "S3Gate"), (S3Gate, "S3Gate"),

View file

@ -15,6 +15,7 @@ class TestHosting(TestCase):
HOST1 = { HOST1 = {
"address": HOST1_ADDRESS, "address": HOST1_ADDRESS,
"plugin_name": HOST1_PLUGIN, "plugin_name": HOST1_PLUGIN,
"healthcheck_plugin_name": "basic",
"attributes": HOST1_ATTRIBUTES, "attributes": HOST1_ATTRIBUTES,
"clis": HOST1_CLIS, "clis": HOST1_CLIS,
"services": HOST1_SERVICES, "services": HOST1_SERVICES,
@ -32,6 +33,7 @@ class TestHosting(TestCase):
HOST2 = { HOST2 = {
"address": HOST2_ADDRESS, "address": HOST2_ADDRESS,
"plugin_name": HOST2_PLUGIN, "plugin_name": HOST2_PLUGIN,
"healthcheck_plugin_name": "basic",
"attributes": HOST2_ATTRIBUTES, "attributes": HOST2_ATTRIBUTES,
"clis": HOST2_CLIS, "clis": HOST2_CLIS,
"services": HOST2_SERVICES, "services": HOST2_SERVICES,
@ -52,18 +54,14 @@ class TestHosting(TestCase):
self.assertEqual(host1.config.plugin_name, self.HOST1_PLUGIN) self.assertEqual(host1.config.plugin_name, self.HOST1_PLUGIN)
self.assertDictEqual(host1.config.attributes, self.HOST1_ATTRIBUTES) self.assertDictEqual(host1.config.attributes, self.HOST1_ATTRIBUTES)
self.assertListEqual(host1.config.clis, [CLIConfig(**cli) for cli in self.HOST1_CLIS]) self.assertListEqual(host1.config.clis, [CLIConfig(**cli) for cli in self.HOST1_CLIS])
self.assertListEqual( self.assertListEqual(host1.config.services, [ServiceConfig(**service) for service in self.HOST1_SERVICES])
host1.config.services, [ServiceConfig(**service) for service in self.HOST1_SERVICES]
)
host2 = hosting.get_host_by_address(self.HOST2_ADDRESS) host2 = hosting.get_host_by_address(self.HOST2_ADDRESS)
self.assertEqual(host2.config.address, self.HOST2_ADDRESS) self.assertEqual(host2.config.address, self.HOST2_ADDRESS)
self.assertEqual(host2.config.plugin_name, self.HOST2_PLUGIN) self.assertEqual(host2.config.plugin_name, self.HOST2_PLUGIN)
self.assertDictEqual(host2.config.attributes, self.HOST2_ATTRIBUTES) self.assertDictEqual(host2.config.attributes, self.HOST2_ATTRIBUTES)
self.assertListEqual(host2.config.clis, [CLIConfig(**cli) for cli in self.HOST2_CLIS]) self.assertListEqual(host2.config.clis, [CLIConfig(**cli) for cli in self.HOST2_CLIS])
self.assertListEqual( self.assertListEqual(host2.config.services, [ServiceConfig(**service) for service in self.HOST2_SERVICES])
host2.config.services, [ServiceConfig(**service) for service in self.HOST2_SERVICES]
)
def test_get_host_by_service(self): def test_get_host_by_service(self):
hosting = Hosting() hosting = Hosting()
@ -104,9 +102,7 @@ class TestHosting(TestCase):
services = hosting.find_service_configs(rf"^{self.SERVICE_NAME_PREFIX}") services = hosting.find_service_configs(rf"^{self.SERVICE_NAME_PREFIX}")
self.assertEqual(len(services), 2) self.assertEqual(len(services), 2)
for service in services: for service in services:
self.assertEqual( self.assertEqual(service.name[: len(self.SERVICE_NAME_PREFIX)], self.SERVICE_NAME_PREFIX)
service.name[: len(self.SERVICE_NAME_PREFIX)], self.SERVICE_NAME_PREFIX
)
service1 = hosting.find_service_configs(self.SERVICE1["name"]) service1 = hosting.find_service_configs(self.SERVICE1["name"])
self.assertEqual(len(service1), 1) self.assertEqual(len(service1), 1)