summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornigoyal <nigoyal@redhat.com>2019-02-04 12:12:53 +0530
committernigoyal <nigoyal@redhat.com>2019-02-04 15:00:08 +0530
commit28e7e4812b442d1851ea34368622a003330e1b54 (patch)
tree0f87650d2401c4628789bed971dbbdc375e81446
parentc1d44b0bed7fd54d056df1724009bd035fabe6d1 (diff)
Add Heketi version checks
Add Heketi version checks to the test cases and Heketi libraries. In case of incompatible Heketi version in a setup, test cases will be skipped and direct usage of Heketi libraries will cause them to raise the NotImplementedError exceptions. Change-Id: I462e76f615165140f2a8c7e796c1c582b8f4dc91
-rw-r--r--cns-libs/cnslibs/common/heketi_ops.py21
-rw-r--r--tests/functional/common/arbiter/test_arbiter.py5
-rw-r--r--tests/functional/common/heketi/test_heketi_metrics.py8
3 files changed, 34 insertions, 0 deletions
diff --git a/cns-libs/cnslibs/common/heketi_ops.py b/cns-libs/cnslibs/common/heketi_ops.py
index a1248687..2fe75572 100644
--- a/cns-libs/cnslibs/common/heketi_ops.py
+++ b/cns-libs/cnslibs/common/heketi_ops.py
@@ -1345,6 +1345,13 @@ def set_arbiter_tag(heketi_client_node, heketi_server_url, source,
exceptions.ExecutionError : when command fails.
"""
+ version = heketi_version.get_heketi_version(heketi_client_node)
+ if version < '6.0.0-11':
+ msg = ("heketi-client package %s does not support arbiter "
+ "functionality" % version.v_str)
+ g.log.error(msg)
+ raise NotImplementedError(msg)
+
if arbiter_tag_value in ('required', 'disabled', 'supported'):
arbiter_tag_value = "arbiter:%s" % arbiter_tag_value
return set_tags(heketi_client_node, heketi_server_url,
@@ -1425,6 +1432,13 @@ def rm_arbiter_tag(heketi_client_node, heketi_server_url, source, source_id,
exceptions.ExecutionError : when command fails.
"""
+ version = heketi_version.get_heketi_version(heketi_client_node)
+ if version < '6.0.0-11':
+ msg = ("heketi-client package %s does not support arbiter "
+ "functionality" % version.v_str)
+ g.log.error(msg)
+ raise NotImplementedError(msg)
+
return rm_tags(heketi_client_node, heketi_server_url,
source, source_id, 'arbiter', **kwargs)
@@ -1447,6 +1461,13 @@ def get_heketi_metrics(heketi_client_node, heketi_server_url,
Metrics output: if successful
"""
+ version = heketi_version.get_heketi_version(heketi_client_node)
+ if version < '6.0.0-14':
+ msg = ("heketi-client package %s does not support heketi "
+ "metrics functionality" % version.v_str)
+ g.log.error(msg)
+ raise NotImplementedError(msg)
+
cmd = "curl --max-time 10 %s/metrics" % heketi_server_url
ret, out, err = g.run(heketi_client_node, cmd)
if ret != 0:
diff --git a/tests/functional/common/arbiter/test_arbiter.py b/tests/functional/common/arbiter/test_arbiter.py
index 63325bc2..9a701fc5 100644
--- a/tests/functional/common/arbiter/test_arbiter.py
+++ b/tests/functional/common/arbiter/test_arbiter.py
@@ -2,6 +2,7 @@ import ddt
from cnslibs.cns import cns_baseclass
from cnslibs.common import heketi_ops
+from cnslibs.common import heketi_version
from cnslibs.common.openshift_ops import (
cmd_run_on_gluster_pod_or_node,
get_gluster_vol_info_by_pvc_name,
@@ -22,6 +23,10 @@ class TestArbiterVolumeCreateExpandDelete(cns_baseclass.BaseClass):
def setUp(self):
super(TestArbiterVolumeCreateExpandDelete, self).setUp()
self.node = self.ocp_master_node[0]
+ version = heketi_version.get_heketi_version(self.heketi_client_node)
+ if version < '6.0.0-11':
+ self.skipTest("heketi-client package %s does not support arbiter "
+ "functionality" % version.v_str)
# Mark one of the Heketi nodes as arbiter-supported if none of
# existent nodes or devices already enabled to support it.
diff --git a/tests/functional/common/heketi/test_heketi_metrics.py b/tests/functional/common/heketi/test_heketi_metrics.py
index 0b8ea53f..701f7d81 100644
--- a/tests/functional/common/heketi/test_heketi_metrics.py
+++ b/tests/functional/common/heketi/test_heketi_metrics.py
@@ -9,6 +9,7 @@ from cnslibs.common.heketi_ops import (
heketi_volume_delete,
heketi_volume_list
)
+from cnslibs.common import heketi_version
from cnslibs.common.openshift_ops import (
get_pod_name_from_dc,
scale_dc_pod_amount_and_wait,
@@ -18,6 +19,13 @@ from cnslibs.common.openshift_ops import (
class TestHeketiMetrics(HeketiBaseClass):
+ def setUp(self):
+ self.node = self.ocp_master_node[0]
+ version = heketi_version.get_heketi_version(self.heketi_client_node)
+ if version < '6.0.0-14':
+ self.skipTest("heketi-client package %s does not support heketi "
+ "metrics functionality" % version.v_str)
+
def verify_heketi_metrics_with_topology_info(self):
topology = heketi_topology_info(
self.heketi_client_node, self.heketi_server_url, json=True)