forked from TrueCloudLab/frostfs-testlib
Adding options to work with any service type
Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
parent
aa277fdd6a
commit
449c18bb1a
2 changed files with 58 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
|||
from abc import ABC, abstractmethod
|
||||
from abc import abstractmethod
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional, Tuple, TypedDict, TypeVar
|
||||
|
||||
|
@ -6,10 +6,13 @@ import yaml
|
|||
|
||||
from frostfs_testlib.hosting.config import ServiceConfig
|
||||
from frostfs_testlib.hosting.interfaces import Host
|
||||
from frostfs_testlib.reporter import get_reporter
|
||||
from frostfs_testlib.storage.constants import ConfigAttributes
|
||||
from frostfs_testlib.testing.readable import HumanReadableABC
|
||||
from frostfs_testlib.utils import wallet_utils
|
||||
|
||||
reporter = get_reporter()
|
||||
|
||||
|
||||
@dataclass
|
||||
class NodeBase(HumanReadableABC):
|
||||
|
@ -54,17 +57,20 @@ class NodeBase(HumanReadableABC):
|
|||
return self._process_name
|
||||
|
||||
def start_service(self):
|
||||
self.host.start_service(self.name)
|
||||
with reporter.step(f"Start {self.name} service on {self.host.config.address}"):
|
||||
self.host.start_service(self.name)
|
||||
|
||||
@abstractmethod
|
||||
def service_healthcheck(self) -> bool:
|
||||
"""Service healthcheck."""
|
||||
|
||||
def stop_service(self):
|
||||
self.host.stop_service(self.name)
|
||||
with reporter.step(f"Stop {self.name} service on {self.host.config.address}"):
|
||||
self.host.stop_service(self.name)
|
||||
|
||||
def restart_service(self):
|
||||
self.host.restart_service(self.name)
|
||||
with reporter.step(f"Restart {self.name} service on {self.host.config.address}"):
|
||||
self.host.restart_service(self.name)
|
||||
|
||||
def get_wallet_password(self) -> str:
|
||||
return self._get_attribute(ConfigAttributes.WALLET_PASSWORD)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue