From d9504697ba78b9c9d179fee6aa83274dddade7a4 Mon Sep 17 00:00:00 2001 From: Yaroslava Lukoyanova Date: Fri, 12 May 2023 09:20:04 +0300 Subject: [PATCH] Add interfaces for deleting fstree, blobovnocza and pilorama.db --- src/frostfs_testlib/hosting/docker_host.py | 9 ++++++ src/frostfs_testlib/hosting/interfaces.py | 30 +++++++++++++++++++ .../storage/dataclasses/frostfs_services.py | 9 ++++++ 3 files changed, 48 insertions(+) diff --git a/src/frostfs_testlib/hosting/docker_host.py b/src/frostfs_testlib/hosting/docker_host.py index 7b224387..ccf1b646 100644 --- a/src/frostfs_testlib/hosting/docker_host.py +++ b/src/frostfs_testlib/hosting/docker_host.py @@ -129,6 +129,15 @@ class DockerHost(Host): timeout=service_attributes.start_timeout, ) + def delete_fstree(self, service_name: str) -> None: + raise NotImplementedError("Not implemented for docker") + + def delete_blobovnicza(self, service_name: str) -> None: + raise NotImplementedError("Not implemented for docker") + + def delete_pilorama(self, service_name: str) -> None: + raise NotImplementedError("Not implemented for docker") + def delete_storage_node_data(self, service_name: str, cache_only: bool = False) -> None: service_attributes = self._get_service_attributes(service_name) diff --git a/src/frostfs_testlib/hosting/interfaces.py b/src/frostfs_testlib/hosting/interfaces.py index 73f49541..8a617e99 100644 --- a/src/frostfs_testlib/hosting/interfaces.py +++ b/src/frostfs_testlib/hosting/interfaces.py @@ -121,6 +121,36 @@ class Host(ABC): cache_only: To delete cache only. """ + @abstractmethod + def delete_fstree(self, service_name: str) -> None: + """ + Deletes all fstrees in the node. + + Args: + service_name: Name of storage node service. + + """ + + @abstractmethod + def delete_blobovnicza(self, service_name: str) -> None: + """ + Deletes all blobovniczas in the node. + + Args: + service_name: Name of storage node service. + + """ + + @abstractmethod + def delete_pilorama(self, service_name: str) -> None: + """ + Deletes all pilorama.db files in the node. + + Args: + service_name: Name of storage node service. + + """ + @abstractmethod def detach_disk(self, device: str) -> DiskInfo: """Detaches disk device to simulate disk offline/failover scenario. diff --git a/src/frostfs_testlib/storage/dataclasses/frostfs_services.py b/src/frostfs_testlib/storage/dataclasses/frostfs_services.py index 1871aa30..e87d264c 100644 --- a/src/frostfs_testlib/storage/dataclasses/frostfs_services.py +++ b/src/frostfs_testlib/storage/dataclasses/frostfs_services.py @@ -168,6 +168,15 @@ class StorageNode(NodeBase): def get_un_locode(self): return self._get_attribute(ConfigAttributes.UN_LOCODE) + def delete_blobovnicza(self): + self.host.delete_blobovnicza(self.name) + + def delete_fstree(self): + self.host.delete_fstree(self.name) + + def delete_pilorama(self): + self.host.delete_pilorama(self.name) + @property def label(self) -> str: return f"{self.name}: {self.get_rpc_endpoint()}"