summaryrefslogtreecommitdiffstats
path: root/tests/functional/prometheous/test_prometheus_validations.py
diff options
context:
space:
mode:
authorubansal <ubansal@redhat.com>2020-09-29 12:38:45 +0530
committerUpasana Bansal <ubansal@redhat.com>2020-09-30 05:14:20 +0000
commit1699e52ac8217b3069d1af9c675357edba0e924b (patch)
tree80eac8679cbdf53a886ec1a016e581e1b92d26b0 /tests/functional/prometheous/test_prometheus_validations.py
parent7963f0ddb4f9db0928cf252c9bbf8e3d298ee012 (diff)
[Test] Add TC to check prometheus device count
Change-Id: I5f3bdbfe51080d8820526f3924d64dd88107e9d7 Signed-off-by: ubansal <ubansal@redhat.com>
Diffstat (limited to 'tests/functional/prometheous/test_prometheus_validations.py')
-rw-r--r--tests/functional/prometheous/test_prometheus_validations.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/functional/prometheous/test_prometheus_validations.py b/tests/functional/prometheous/test_prometheus_validations.py
index f275bc8b..5c140a02 100644
--- a/tests/functional/prometheous/test_prometheus_validations.py
+++ b/tests/functional/prometheous/test_prometheus_validations.py
@@ -13,6 +13,7 @@ import pytest
from openshiftstoragelibs.baseclass import GlusterBlockBaseClass
from openshiftstoragelibs import command
from openshiftstoragelibs import exceptions
+from openshiftstoragelibs import heketi_ops
from openshiftstoragelibs import openshift_ops
@@ -176,3 +177,33 @@ class TestPrometheusAndGlusterRegistryValidation(GlusterBlockBaseClass):
# Try to fetch metric from prometheus pod
self._fetch_metric_from_promtheus_pod(metric='kube_node_info')
+
+ @pytest.mark.tier2
+ def test_heketi_and_prometheus_device_count(self):
+ """Check if device count is same in heketi and promtheus"""
+
+ cluster_ids_metrics, cluster_ids_promtheus = [], []
+ hostnames_metrics, hostnames_promtheus = [], []
+ total_value_metrics, total_value_promtheus = 0, 0
+
+ metrics = heketi_ops.get_heketi_metrics(
+ self.heketi_client_node, self.heketi_server_url)
+ heketi_device_count_metric = metrics.get('heketi_device_count')
+ for result in heketi_device_count_metric:
+ cluster_ids_metrics.append(result.get('cluster'))
+ hostnames_metrics.append(result.get('hostname'))
+ total_value_metrics += int(result.get('value'))
+
+ metric_result = self._fetch_metric_from_promtheus_pod(
+ metric='heketi_device_count')
+ for result in metric_result:
+ total_value_promtheus += int(result.get('value')[1])
+ cluster_ids_promtheus.append(result.get('metric')['cluster'])
+ hostnames_promtheus.append(result.get('metric')['hostname'])
+
+ self.assertEqual(cluster_ids_metrics, cluster_ids_promtheus,
+ "Cluster ID's are not same")
+ self.assertEqual(hostnames_metrics, hostnames_promtheus,
+ "Hostnames are not same")
+ self.assertEqual(total_value_metrics, total_value_promtheus,
+ "Total device counts are not same")