From 608a523b5eb9137ac0a28b2f155075234c485924 Mon Sep 17 00:00:00 2001 From: Yaroslava Lukoyanova Date: Mon, 5 Jun 2023 12:10:32 +0300 Subject: [PATCH] Add get_data_directory function --- src/frostfs_testlib/hosting/docker_host.py | 4 ++++ src/frostfs_testlib/hosting/interfaces.py | 12 ++++++++++++ .../storage/dataclasses/frostfs_services.py | 3 +++ 3 files changed, 19 insertions(+) diff --git a/src/frostfs_testlib/hosting/docker_host.py b/src/frostfs_testlib/hosting/docker_host.py index b7f4852..34d493d 100644 --- a/src/frostfs_testlib/hosting/docker_host.py +++ b/src/frostfs_testlib/hosting/docker_host.py @@ -129,6 +129,10 @@ class DockerHost(Host): timeout=service_attributes.start_timeout, ) + def get_data_directory(self, service_name: str) -> str: + service_attributes = self._get_service_attributes(service_name) + return service_attributes.data_directory_path + def delete_metabase(self, service_name: str) -> None: raise NotImplementedError("Not implemented for docker") diff --git a/src/frostfs_testlib/hosting/interfaces.py b/src/frostfs_testlib/hosting/interfaces.py index 9178523..2b1453c 100644 --- a/src/frostfs_testlib/hosting/interfaces.py +++ b/src/frostfs_testlib/hosting/interfaces.py @@ -112,6 +112,18 @@ class Host(ABC): service_name: Name of the service to restart. """ + + @abstractmethod + def get_data_directory(self, service_name: str) -> str: + """ + Getting path to data directory on node for further usage + (example: list databases pilorama.db) + + Args: + service_name: Name of storage node service. + """ + + @abstractmethod def delete_storage_node_data(self, service_name: str, cache_only: bool = False) -> None: """Erases all data of the storage node with specified name. diff --git a/src/frostfs_testlib/storage/dataclasses/frostfs_services.py b/src/frostfs_testlib/storage/dataclasses/frostfs_services.py index 7bb4c2b..2b52c1f 100644 --- a/src/frostfs_testlib/storage/dataclasses/frostfs_services.py +++ b/src/frostfs_testlib/storage/dataclasses/frostfs_services.py @@ -167,6 +167,9 @@ class StorageNode(NodeBase): def get_un_locode(self): return self._get_attribute(ConfigAttributes.UN_LOCODE) + + def get_data_directory(self) -> str: + return self.host.get_data_directory(self.name) def delete_blobovnicza(self): self.host.delete_blobovnicza(self.name) -- 2.45.2