forked from TrueCloudLab/frostfs-testlib
[#133] Change reporter usage
Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
parent
39a17f3634
commit
dc6b0e407f
37 changed files with 478 additions and 678 deletions
|
@ -1,8 +1,8 @@
|
|||
from typing import Callable
|
||||
|
||||
from frostfs_testlib import reporter
|
||||
from frostfs_testlib.cli.frostfs_cli.cli import FrostfsCli
|
||||
from frostfs_testlib.healthcheck.interfaces import Healthcheck
|
||||
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
|
||||
|
@ -10,8 +10,6 @@ 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()
|
||||
|
||||
|
||||
class BasicHealthcheck(Healthcheck):
|
||||
def _perform(self, cluster_node: ClusterNode, checks: dict[Callable, dict]):
|
||||
|
@ -23,36 +21,33 @@ class BasicHealthcheck(Healthcheck):
|
|||
|
||||
assert not issues, "Issues found:\n" + "\n".join(issues)
|
||||
|
||||
@wait_for_success(900, 30)
|
||||
@wait_for_success(900, 30, title="Wait for full healthcheck for {cluster_node}")
|
||||
def full_healthcheck(self, cluster_node: ClusterNode):
|
||||
checks = {
|
||||
self.storage_healthcheck: {},
|
||||
self._tree_healthcheck: {},
|
||||
}
|
||||
|
||||
with reporter.step(f"Perform full healthcheck for {cluster_node}"):
|
||||
self._perform(cluster_node, checks)
|
||||
self._perform(cluster_node, checks)
|
||||
|
||||
@wait_for_success(900, 30)
|
||||
@wait_for_success(900, 30, title="Wait for startup healthcheck on {cluster_node}")
|
||||
def startup_healthcheck(self, cluster_node: ClusterNode):
|
||||
checks = {
|
||||
self.storage_healthcheck: {},
|
||||
self._tree_healthcheck: {},
|
||||
}
|
||||
|
||||
with reporter.step(f"Perform startup healthcheck on {cluster_node}"):
|
||||
self._perform(cluster_node, checks)
|
||||
self._perform(cluster_node, checks)
|
||||
|
||||
@wait_for_success(900, 30)
|
||||
@wait_for_success(900, 30, title="Wait for storage healthcheck on {cluster_node}")
|
||||
def storage_healthcheck(self, cluster_node: ClusterNode) -> str | None:
|
||||
checks = {
|
||||
self._storage_healthcheck: {},
|
||||
}
|
||||
|
||||
with reporter.step(f"Perform storage healthcheck on {cluster_node}"):
|
||||
self._perform(cluster_node, checks)
|
||||
self._perform(cluster_node, checks)
|
||||
|
||||
@wait_for_success(120, 5)
|
||||
@wait_for_success(120, 5, title="Wait for service healthcheck on {cluster_node}")
|
||||
def services_healthcheck(self, cluster_node: ClusterNode):
|
||||
svcs_to_check = cluster_node.services
|
||||
checks = {
|
||||
|
@ -63,8 +58,7 @@ class BasicHealthcheck(Healthcheck):
|
|||
self._check_services: {"services": svcs_to_check},
|
||||
}
|
||||
|
||||
with reporter.step(f"Perform service healthcheck on {cluster_node}"):
|
||||
self._perform(cluster_node, checks)
|
||||
self._perform(cluster_node, checks)
|
||||
|
||||
def _check_services(self, cluster_node: ClusterNode, services: list[ServiceClass]):
|
||||
for svc in services:
|
||||
|
@ -72,14 +66,14 @@ class BasicHealthcheck(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}")
|
||||
@reporter.step("Storage healthcheck on {cluster_node}")
|
||||
def _storage_healthcheck(self, cluster_node: ClusterNode) -> str | None:
|
||||
result = storage_node_healthcheck(cluster_node.storage_node)
|
||||
self._gather_socket_info(cluster_node)
|
||||
if result.health_status != "READY" or result.network_status != "ONLINE":
|
||||
return f"Node {cluster_node} is not healthy. Health={result.health_status}. Network={result.network_status}"
|
||||
|
||||
@reporter.step_deco("Tree healthcheck on {cluster_node}")
|
||||
@reporter.step("Tree healthcheck on {cluster_node}")
|
||||
def _tree_healthcheck(self, cluster_node: ClusterNode) -> str | None:
|
||||
host = cluster_node.host
|
||||
service_config = host.get_service_config(cluster_node.storage_node.name)
|
||||
|
@ -102,6 +96,6 @@ class BasicHealthcheck(Healthcheck):
|
|||
f"Error during tree healthcheck (rc={result.return_code}): {result.stdout}. \n Stderr: {result.stderr}"
|
||||
)
|
||||
|
||||
@reporter.step_deco("Gather socket info for {cluster_node}")
|
||||
@reporter.step("Gather socket info for {cluster_node}")
|
||||
def _gather_socket_info(self, cluster_node: ClusterNode):
|
||||
cluster_node.host.get_shell().exec("ss -tuln | grep 8080", CommandOptions(check=False))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue