forked from TrueCloudLab/frostfs-testcases
[#360] Added epoch metrics test
Signed-off-by: Ilyas Niyazov <i.niyazov@yadro.com>
This commit is contained in:
parent
4f989e4260
commit
2976d3f936
1 changed files with 40 additions and 0 deletions
40
pytest_tests/testsuites/metrics/test_epoch_metrics.py
Normal file
40
pytest_tests/testsuites/metrics/test_epoch_metrics.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
import allure
|
||||
from frostfs_testlib.testing import parallel
|
||||
import pytest
|
||||
from frostfs_testlib import reporter
|
||||
from frostfs_testlib.steps.metrics import get_metrics_value
|
||||
from frostfs_testlib.storage.cluster import ClusterNode
|
||||
from frostfs_testlib.testing.cluster_test_base import ClusterTestBase
|
||||
|
||||
|
||||
@pytest.mark.order(-11)
|
||||
@pytest.mark.nightly
|
||||
@pytest.mark.metrics
|
||||
class TestEpochMetrics(ClusterTestBase):
|
||||
@reporter.step("Get metrics value from node: {node}")
|
||||
def get_metrics_search_by_greps_parallel(self, node: ClusterNode, **greps):
|
||||
try:
|
||||
return get_metrics_value(node, parse_from_command=True, **greps)
|
||||
except Exception as e:
|
||||
return None
|
||||
|
||||
@allure.title("Check changes in metric frostfs_node_ir_epoch value")
|
||||
def test_check_increase_epoch_metric(self):
|
||||
metric_name = "frostfs_node_ir_epoch"
|
||||
with reporter.step("Get current value of metric: {metric_name} from each nodes"):
|
||||
futures = parallel(self.get_metrics_search_by_greps_parallel, self.cluster.cluster_nodes, command=metric_name)
|
||||
metrics_results = [future.result() for future in futures if future.result() is not None]
|
||||
|
||||
with reporter.step("Check that the metric values are the same in all nodes"):
|
||||
assert len(set(metrics_results)) == 1, f"Metric {metric_name} values aren't same in all nodes"
|
||||
assert len(metrics_results) == len(self.cluster.cluster_nodes), "Metrics are not available in some nodes"
|
||||
|
||||
with reporter.step("Tick epoch"):
|
||||
self.tick_epoch(wait_block=2)
|
||||
|
||||
with reporter.step('Check that metric value increase'):
|
||||
futures = parallel(self.get_metrics_search_by_greps_parallel, self.cluster.cluster_nodes, command=metric_name)
|
||||
new_metrics_results = [future.result() for future in futures if future.result() is not None]
|
||||
|
||||
assert len(set(new_metrics_results)) == 1, f"Metric {metric_name} values aren't same in all nodes"
|
||||
assert new_metrics_results[0] > metrics_results[0], "Metric value doesn't increased"
|
Loading…
Add table
Reference in a new issue