diff options
author | Arun Kumar <arukumar@arukumar.remote.csb> | 2019-09-16 10:00:16 +0530 |
---|---|---|
committer | Vaibhav Mahajan <vamahaja@redhat.com> | 2019-12-26 12:25:25 +0000 |
commit | 5ae45abc159a37af04c43acf45dd4b0a21f323a2 (patch) | |
tree | 7f3f6f15060eaaa5c3b8f0f95919f405ec306aca /tests/functional/metrics/test_metrics_validation.py | |
parent | d28b637d972aa600ed15ef437e4cb59c53e0ca5e (diff) |
Add TC and config data for metrics
Test case to validate metrics
add config data for metrics
add config data of registry namespace to validate metrics
Change-Id: I4886482ee33847f506ad898d4a313df866d0348c
Diffstat (limited to 'tests/functional/metrics/test_metrics_validation.py')
-rw-r--r-- | tests/functional/metrics/test_metrics_validation.py | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/functional/metrics/test_metrics_validation.py b/tests/functional/metrics/test_metrics_validation.py new file mode 100644 index 00000000..07cda67f --- /dev/null +++ b/tests/functional/metrics/test_metrics_validation.py @@ -0,0 +1,64 @@ +from glusto.core import Glusto as g + +from openshiftstoragelibs.baseclass import GlusterBlockBaseClass +from openshiftstoragelibs import command +from openshiftstoragelibs.openshift_ops import ( + get_pod_name_from_rc, + oc_get_custom_resource, + switch_oc_project, + verify_pvc_status_is_bound, + wait_for_pod_be_ready, +) + + +class TestMetricsAndGlusterRegistryValidation(GlusterBlockBaseClass): + + def setUp(self): + """Initialize all the variables necessary for test cases.""" + super(TestMetricsAndGlusterRegistryValidation, self).setUp() + + try: + metrics_config = g.config['openshift']['metrics'] + self.metrics_project_name = metrics_config['metrics_project_name'] + self.metrics_rc_hawkular_cassandra = ( + metrics_config['metrics_rc_hawkular_cassandra']) + self.metrics_rc_hawkular_metrics = ( + metrics_config['metrics_rc_hawkular_metrics']) + self.metrics_rc_heapster = metrics_config['metrics_rc_heapster'] + self.registry_heketi_server_url = ( + g.config['openshift']['registry_heketi_config'][ + 'heketi_server_url']) + except KeyError as err: + msg = ("Config file doesn't have key %s" % err) + g.log.error(msg) + self.skipTest(msg) + + self.master = self.ocp_master_node[0] + cmd = "oc project --short=true" + current_project = command.cmd_run(cmd, self.master) + switch_oc_project(self.master, self.metrics_project_name) + self.addCleanup(switch_oc_project, self.master, current_project) + + def test_validate_metrics_pods_and_pvc(self): + """Validate metrics pods and PVC""" + # Get cassandra pod name and PVC name + hawkular_cassandra = get_pod_name_from_rc( + self.master, self.metrics_rc_hawkular_cassandra) + custom = ":.spec.volumes[*].persistentVolumeClaim.claimName" + pvc_name = oc_get_custom_resource( + self.master, "pod", custom, hawkular_cassandra)[0] + + # Wait for pods to get ready and PVC to be bound + verify_pvc_status_is_bound(self.master, pvc_name) + wait_for_pod_be_ready(self.master, hawkular_cassandra) + hawkular_metrics = get_pod_name_from_rc( + self.master, self.metrics_rc_hawkular_metrics) + wait_for_pod_be_ready(self.master, hawkular_metrics) + heapster = get_pod_name_from_rc(self.master, self.metrics_rc_heapster) + wait_for_pod_be_ready(self.master, heapster) + + # Validate iscsi and multipath + self.verify_iscsi_sessions_and_multipath( + pvc_name, self.metrics_rc_hawkular_cassandra, rtype='rc', + heketi_server_url=self.registry_heketi_server_url, + is_registry_gluster=True) |