diff options
author | Valerii Ponomarov <vponomar@redhat.com> | 2018-12-20 23:04:22 +0530 |
---|---|---|
committer | Valerii Ponomarov <vponomar@redhat.com> | 2018-12-25 20:54:32 +0530 |
commit | 8b6107b62dacf5edc264f4f0206771d8fa07f7bf (patch) | |
tree | 775a3755324ea3a272a65ba9eddf100a605208d1 /tests/functional/common/heketi/heketi_tests | |
parent | 418b6a6dd31e70888cfcc343922d43e4646f7184 (diff) |
Add abstraction between deployment types and gluster commands
Now, it is possible to run glustolibs commands
on both deployment types: containerized and standalone.
It is possible using 'auto_get_gluster_endpoint' as target for
lib function in addition to the '@podcmd.GlustoPod()' decorator.
Example:
"""
from glustolibs.gluster.volume_ops import get_volume_list
from cnslibs.common import heketi_libs
from cnslibs.common import podcmd
class TestExample(heketi_libs.HeketiBaseClass):
@podcmd.GlustoPod()
def test_get_vol_list_either_on_node_or_on_pod(self):
volumes = get_volume_list('auto_get_gluster_endpoint')
"""
Also, delete all the current usages of 'deployment_type' config option,
and delete the option as unneeded anymore.
Change-Id: I281f287c432a5a9efefda588be436ee285188697
Diffstat (limited to 'tests/functional/common/heketi/heketi_tests')
3 files changed, 10 insertions, 38 deletions
diff --git a/tests/functional/common/heketi/heketi_tests/test_disabling_device.py b/tests/functional/common/heketi/heketi_tests/test_disabling_device.py index 43d222a2..5d5e867c 100644 --- a/tests/functional/common/heketi/heketi_tests/test_disabling_device.py +++ b/tests/functional/common/heketi/heketi_tests/test_disabling_device.py @@ -4,7 +4,6 @@ from glustolibs.gluster.volume_ops import get_volume_info from cnslibs.common import exceptions from cnslibs.common import heketi_libs from cnslibs.common import heketi_ops -from cnslibs.common import openshift_ops from cnslibs.common import podcmd @@ -122,12 +121,6 @@ class TestDisableHeketiDevice(heketi_libs.HeketiBaseClass): name = out["name"] # Get gluster volume info - if self.deployment_type == "cns": - gluster_pod = openshift_ops.get_ocp_gluster_pod_names( - self.heketi_client_node)[1] - p = podcmd.Pod(self.heketi_client_node, gluster_pod) - out = get_volume_info(p, volname=name) - else: - out = get_volume_info(self.heketi_client_node, volname=name) - self.assertTrue(out, "Failed to get '%s' volume info." % name) + vol_info = get_volume_info('auto_get_gluster_endpoint', volname=name) + self.assertTrue(vol_info, "Failed to get '%s' volume info." % name) g.log.info("Successfully got the '%s' volume info." % name) diff --git a/tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py b/tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py index 7f2a61da..7963413b 100644 --- a/tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py +++ b/tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py @@ -16,7 +16,6 @@ from cnslibs.common.heketi_ops import (heketi_volume_create, heketi_node_info, heketi_node_list, heketi_node_delete) -from cnslibs.common.openshift_ops import get_ocp_gluster_pod_names from cnslibs.common import podcmd @@ -53,24 +52,18 @@ class TestHeketiVolume(HeketiBaseClass): g.log.info("Heketi volumes successfully listed") g.log.info("List gluster volumes") - if self.deployment_type == "cns": - gluster_pod = get_ocp_gluster_pod_names( - self.heketi_client_node)[1] - p = podcmd.Pod(self.heketi_client_node, gluster_pod) - out = get_volume_list(p) - else: - out = get_volume_list(self.heketi_client_node) - self.assertTrue(out, ("Unable to get volumes list")) + vol_list = get_volume_list('auto_get_gluster_endpoint') + self.assertTrue(vol_list, ("Unable to get volumes list")) g.log.info("Successfully got the volumes list") # Check the volume count are equal self.assertEqual( - len(volumes["volumes"]), len(out), + len(volumes["volumes"]), len(vol_list), "Lengths of gluster '%s' and heketi '%s' volume lists are " - "not equal." % (out, volumes) + "not equal." % (vol_list, volumes) ) g.log.info("Heketi volumes list %s and" - " gluster volumes list %s" % ((volumes), (out))) + " gluster volumes list %s" % (volumes, vol_list)) @podcmd.GlustoPod() def test_create_vol_and_retrieve_vol_info(self): @@ -97,15 +90,8 @@ class TestHeketiVolume(HeketiBaseClass): g.log.info("Successfully got the heketi volume info") name = out["name"] - if self.deployment_type == "cns": - gluster_pod = get_ocp_gluster_pod_names( - self.heketi_client_node)[1] - p = podcmd.Pod(self.heketi_client_node, gluster_pod) - out = get_volume_info(p, volname=name) - else: - out = get_volume_info(self.heketi_client_node, - volname=name) - self.assertTrue(out, ("Failed to get volume info %s" % name)) + vol_info = get_volume_info('auto_get_gluster_endpoint', volname=name) + self.assertTrue(vol_info, "Failed to get volume info %s" % name) g.log.info("Successfully got the volume info %s" % name) def test_to_check_deletion_of_cluster(self): diff --git a/tests/functional/common/heketi/heketi_tests/test_node_info.py b/tests/functional/common/heketi/heketi_tests/test_node_info.py index 016b3ec4..3f956d62 100644 --- a/tests/functional/common/heketi/heketi_tests/test_node_info.py +++ b/tests/functional/common/heketi/heketi_tests/test_node_info.py @@ -4,7 +4,6 @@ from glustolibs.gluster.peer_ops import get_pool_list from cnslibs.common.heketi_libs import HeketiBaseClass from cnslibs.common import heketi_ops, podcmd -from cnslibs.common.openshift_ops import get_ocp_gluster_pod_names class TestHeketiVolume(HeketiBaseClass): @@ -44,13 +43,7 @@ class TestHeketiVolume(HeketiBaseClass): hostname = [] g.log.info("Get the pool list") - if self.deployment_type == "cns": - gluster_pod = get_ocp_gluster_pod_names( - self.heketi_client_node)[1] - p = podcmd.Pod(self.heketi_client_node, gluster_pod) - list_of_pools = get_pool_list(p) - else: - list_of_pools = get_pool_list(self.heketi_client_node) + list_of_pools = get_pool_list('auto_get_gluster_endpoint') self.assertTrue(list_of_pools, ("Failed to get the " "pool list from gluster pods/nodes")) g.log.info("Successfully got the pool list from gluster pods/nodes") |