summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun <arukumar@redhat.com>2019-11-12 14:07:57 +0530
committerArun <arukumar@redhat.com>2020-01-24 16:20:41 +0530
commit9a88d49487f3d8a4e4444050cb50e33e44d05c8d (patch)
tree4a4f16cce7f7a36fb6a89b692bc669431da2ca57
parent4636f6b080156388bed026c94a9e6ea8fd9242e9 (diff)
[Test] Add tc to validate matrics during cassandra pod deletion
Change-Id: Ie72a25ce90fd10dd8b86878d235d71814703b1ef
-rw-r--r--tests/functional/metrics/test_metrics_validation.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/functional/metrics/test_metrics_validation.py b/tests/functional/metrics/test_metrics_validation.py
index d0c01c0..590fc29 100644
--- a/tests/functional/metrics/test_metrics_validation.py
+++ b/tests/functional/metrics/test_metrics_validation.py
@@ -1,7 +1,10 @@
+from pkg_resources import parse_version
+
from glusto.core import Glusto as g
from openshiftstoragelibs.baseclass import GlusterBlockBaseClass
from openshiftstoragelibs import command
+from openshiftstoragelibs import exceptions
from openshiftstoragelibs.openshift_ops import (
get_ocp_gluster_pod_details,
get_pod_name_from_rc,
@@ -45,6 +48,21 @@ class TestMetricsAndGlusterRegistryValidation(GlusterBlockBaseClass):
g.log.error(msg)
self.skipTest(msg)
+ # Skip the test if iscsi-initiator-utils version is not the expected
+ cmd = ("rpm -q iscsi-initiator-utils "
+ "--queryformat '%{version}-%{release}\n'"
+ "| cut -d '.' -f 1,2,3,4")
+ e_pkg_version = "6.2.0.874-17"
+ for g_server in self.gluster_servers:
+ out = self.cmd_run(cmd, g_server)
+ if parse_version(out) < parse_version(e_pkg_version):
+ msg = ("Skip test since isci initiator utils version actual: "
+ "{out} is less than expected: {ver} on node {server},"
+ " for more info refer to BZ-1624670"
+ .format(out=out, ver=e_pkg_version, server=g_server))
+ 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)
@@ -134,3 +152,37 @@ class TestMetricsAndGlusterRegistryValidation(GlusterBlockBaseClass):
pvc_name, self.metrics_rc_hawkular_cassandra,
rtype='rc', heketi_server_url=self.registry_heketi_server_url,
is_registry_gluster=True)
+
+ def cassandra_pod_delete_cleanup(self):
+ """Cleanup for deletion of cassandra pod using force delete"""
+ try:
+ # Check if pod is up or ready
+ pod_name = get_pod_name_from_rc(
+ self.master, self.metrics_rc_hawkular_cassandra)
+ wait_for_pod_be_ready(self.master, pod_name, timeout=1)
+ except exceptions.ExecutionError:
+ # Force delete and wait for new pod to come up
+ oc_delete(self.master, 'pod', pod_name, is_force=True)
+ wait_for_resources_absence(self.master, 'pod', pod_name)
+ new_pod_name = get_pod_name_from_rc(
+ self.master, self.metrics_rc_hawkular_cassandra)
+ wait_for_pod_be_ready(self.master, new_pod_name)
+
+ def test_metrics_during_cassandra_pod_respin(self):
+ """Validate cassandra pod respin"""
+ old_cassandra_pod, pvc_name, _, _, _ = (
+ self.verify_cassandra_pod_multipath_and_iscsi())
+
+ # Delete the cassandra pod and wait for new pod to be ready
+ oc_delete(self.master, 'pod', old_cassandra_pod)
+ self.addCleanup(self.cassandra_pod_delete_cleanup)
+ wait_for_resources_absence(self.master, 'pod', old_cassandra_pod)
+ new_cassandra_pod = get_pod_name_from_rc(
+ self.master, self.metrics_rc_hawkular_cassandra)
+ wait_for_pod_be_ready(self.master, new_cassandra_pod)
+
+ # 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)