forked from TrueCloudLab/frostfs-testlib
Shards are attribute of StorageNode class
This commit is contained in:
parent
73c362c307
commit
a4d1082ed5
3 changed files with 135 additions and 6 deletions
|
@ -3,7 +3,7 @@ import yaml
|
|||
from frostfs_testlib.blockchain import RPCClient
|
||||
from frostfs_testlib.storage.constants import ConfigAttributes
|
||||
from frostfs_testlib.storage.dataclasses.node_base import NodeBase
|
||||
|
||||
from frostfs_testlib.storage.dataclasses.shard import Shard
|
||||
|
||||
class InnerRing(NodeBase):
|
||||
"""
|
||||
|
@ -148,6 +148,20 @@ class StorageNode(NodeBase):
|
|||
def get_shards_config(self) -> tuple[str, dict]:
|
||||
return self.get_config(self.get_shard_config_path())
|
||||
|
||||
def get_shards(self) -> list[Shard]:
|
||||
config = self.get_shards_config()[1]
|
||||
config["storage"]["shard"].pop("default")
|
||||
return [Shard.from_object(shard) for shard in config["storage"]["shard"].values()]
|
||||
|
||||
def get_shards_from_env(self) -> list[Shard]:
|
||||
config = self.get_shards_config()[1]
|
||||
configObj = ConfigObj(StringIO(config))
|
||||
|
||||
pattern = f"{SHARD_PREFIX}\d*"
|
||||
num_shards = len(set(re.findall(pattern, self.get_shards_config())))
|
||||
|
||||
return [Shard.from_config_object(configObj, shard_id) for shard_id in range(num_shards)]
|
||||
|
||||
def get_control_endpoint(self) -> str:
|
||||
return self._get_attribute(ConfigAttributes.CONTROL_ENDPOINT)
|
||||
|
||||
|
@ -157,6 +171,9 @@ class StorageNode(NodeBase):
|
|||
def get_data_directory(self) -> str:
|
||||
return self.host.get_data_directory(self.name)
|
||||
|
||||
def get_storage_config(self) -> str:
|
||||
return self.host.get_storage_config(self.name)
|
||||
|
||||
def get_http_hostname(self) -> str:
|
||||
return self._get_attribute(ConfigAttributes.HTTP_HOSTNAME)
|
||||
|
||||
|
@ -169,8 +186,11 @@ class StorageNode(NodeBase):
|
|||
def delete_fstree(self):
|
||||
self.host.delete_fstree(self.name)
|
||||
|
||||
def delete_pilorama(self):
|
||||
self.host.delete_pilorama(self.name)
|
||||
def delete_file(self, file_path: str) -> None:
|
||||
self.host.delete_file(file_path)
|
||||
|
||||
def is_file_exist(self, file_path) -> bool:
|
||||
return self.host.is_file_exist(file_path)
|
||||
|
||||
def delete_metabase(self):
|
||||
self.host.delete_metabase(self.name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue