forked from TrueCloudLab/frostfs-testlib
[#130] Add service healthcheck and allow to skip version check for some binaries
Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
parent
d1ba7eb661
commit
c17f0f6173
5 changed files with 69 additions and 24 deletions
|
@ -6,8 +6,9 @@ from frostfs_testlib.reporter import get_reporter
|
|||
from frostfs_testlib.resources.cli import FROSTFS_CLI_EXEC
|
||||
from frostfs_testlib.shell import CommandOptions
|
||||
from frostfs_testlib.steps.node_management import storage_node_healthcheck
|
||||
from frostfs_testlib.storage.cluster import ClusterNode
|
||||
from frostfs_testlib.storage.cluster import ClusterNode, ServiceClass
|
||||
from frostfs_testlib.testing.test_control import wait_for_success
|
||||
from frostfs_testlib.utils.failover_utils import check_services_status
|
||||
|
||||
reporter = get_reporter()
|
||||
|
||||
|
@ -51,6 +52,26 @@ class BasicHealthcheck(Healthcheck):
|
|||
with reporter.step(f"Perform storage healthcheck on {cluster_node}"):
|
||||
self._perform(cluster_node, checks)
|
||||
|
||||
@wait_for_success(120, 5)
|
||||
def services_healthcheck(self, cluster_node: ClusterNode):
|
||||
svcs_to_check = cluster_node.services
|
||||
checks = {
|
||||
check_services_status: {
|
||||
"service_list": svcs_to_check,
|
||||
"expected_status": "active",
|
||||
},
|
||||
self._check_services: {"services": svcs_to_check},
|
||||
}
|
||||
|
||||
with reporter.step(f"Perform service healthcheck on {cluster_node}"):
|
||||
self._perform(cluster_node, checks)
|
||||
|
||||
def _check_services(self, cluster_node: ClusterNode, services: list[ServiceClass]):
|
||||
for svc in services:
|
||||
result = svc.service_healthcheck()
|
||||
if result == False:
|
||||
return f"Service {svc.get_service_systemctl_name()} healthcheck failed on node {cluster_node}."
|
||||
|
||||
@reporter.step_deco("Storage healthcheck on {cluster_node}")
|
||||
def _storage_healthcheck(self, cluster_node: ClusterNode) -> str | None:
|
||||
result = storage_node_healthcheck(cluster_node.storage_node)
|
||||
|
|
|
@ -15,3 +15,7 @@ class Healthcheck(ABC):
|
|||
@abstractmethod
|
||||
def storage_healthcheck(self, cluster_node: ClusterNode):
|
||||
"""Perform storage service healthcheck on target cluster node"""
|
||||
|
||||
@abstractmethod
|
||||
def services_healthcheck(self, cluster_node: ClusterNode):
|
||||
"""Perform service status check on target cluster node"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue