summaryrefslogtreecommitdiffstats
path: root/tests/functional/common/heketi/heketi_tests
diff options
context:
space:
mode:
authorvamahaja <vamahaja@redhat.com>2019-02-08 14:01:53 +0530
committervponomar <vponomar@redhat.com>2019-02-22 11:22:41 +0000
commiteb396cc001519bfc3d27061a81a7cbf0692e4853 (patch)
tree1606ea5579a8c1c8da34a980080782bf0f7fd8c5 /tests/functional/common/heketi/heketi_tests
parentd62b88c330a36142f8e0ac18c3713908e3ca26be (diff)
Merged HeketiBaseClass to BaseClass
Renamed cns_baseclass.py to baseclass.py with updated BaseClass. Merged HeketiBaseClass to BaseClass with appropriate changes. Updated delete_volumes and delete_block_volumes methods used in test case method with heketi_delete_volume and heketi_blockvolume- delete. Change-Id: I8f623f1692cd863dc8ff041f7e8525ee0dc84f7b Signed-off-by: vamahaja <vamahaja@redhat.com>
Diffstat (limited to 'tests/functional/common/heketi/heketi_tests')
-rw-r--r--tests/functional/common/heketi/heketi_tests/test_disabling_device.py15
-rw-r--r--tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py23
-rw-r--r--tests/functional/common/heketi/heketi_tests/test_node_enable_disable.py24
-rw-r--r--tests/functional/common/heketi/heketi_tests/test_node_info.py4
4 files changed, 42 insertions, 24 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 6139f64d..f0e2c5c6 100644
--- a/tests/functional/common/heketi/heketi_tests/test_disabling_device.py
+++ b/tests/functional/common/heketi/heketi_tests/test_disabling_device.py
@@ -2,12 +2,12 @@ from glusto.core import Glusto as g
from glustolibs.gluster.volume_ops import get_volume_info
from cnslibs.common import exceptions
-from cnslibs.common import heketi_libs
+from cnslibs.common import baseclass
from cnslibs.common import heketi_ops
from cnslibs.common import podcmd
-class TestDisableHeketiDevice(heketi_libs.HeketiBaseClass):
+class TestDisableHeketiDevice(baseclass.BaseClass):
@podcmd.GlustoPod()
def test_create_volumes_enabling_and_disabling_heketi_devices(self):
"""Validate enable/disable of heketi device"""
@@ -57,7 +57,9 @@ class TestDisableHeketiDevice(heketi_libs.HeketiBaseClass):
self.assertTrue(out, "Failed to create heketi volume of size 1")
g.log.info("Successfully created heketi volume of size 1")
device_id = out["bricks"][0]["device"]
- self.addCleanup(self.delete_volumes, [out["bricks"][0]["volume"]])
+ self.addCleanup(
+ heketi_ops.heketi_volume_delete, self.heketi_client_node,
+ self.heketi_server_url, out["bricks"][0]["volume"])
# Disable device
g.log.info("Disabling '%s' device" % device_id)
@@ -90,7 +92,8 @@ class TestDisableHeketiDevice(heketi_libs.HeketiBaseClass):
g.log.info("Volume was not created as expected.")
else:
self.addCleanup(
- self.delete_volumes, [out["bricks"][0]["volume"]])
+ heketi_ops.heketi_volume_delete, self.heketi_client_node,
+ self.heketi_server_url, out["bricks"][0]["volume"])
msg = "Volume unexpectedly created. Out: %s" % out
assert False, msg
finally:
@@ -116,7 +119,9 @@ class TestDisableHeketiDevice(heketi_libs.HeketiBaseClass):
out = heketi_ops.heketi_volume_create(
self.heketi_client_node, self.heketi_server_url, 1, json=True)
self.assertTrue(out, "Failed to create volume of size 1")
- self.addCleanup(self.delete_volumes, [out["bricks"][0]["volume"]])
+ self.addCleanup(
+ heketi_ops.heketi_volume_delete, self.heketi_client_node,
+ self.heketi_server_url, out["bricks"][0]["volume"])
g.log.info("Successfully created volume of size 1")
name = out["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 b03e5e30..c1be0d86 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
@@ -3,7 +3,7 @@ from glustolibs.gluster.volume_ops import get_volume_list, get_volume_info
import six
from cnslibs.common.exceptions import ExecutionError
-from cnslibs.common.heketi_libs import HeketiBaseClass
+from cnslibs.common.baseclass import BaseClass
from cnslibs.common.heketi_ops import (heketi_volume_create,
heketi_volume_list,
heketi_volume_info,
@@ -13,11 +13,12 @@ from cnslibs.common.heketi_ops import (heketi_volume_create,
heketi_cluster_delete,
heketi_node_info,
heketi_node_list,
- heketi_node_delete)
+ heketi_node_delete,
+ heketi_volume_delete)
from cnslibs.common import podcmd
-class TestHeketiVolume(HeketiBaseClass):
+class TestHeketiVolume(BaseClass):
"""
Class to test heketi volume create
"""
@@ -45,7 +46,9 @@ class TestHeketiVolume(HeketiBaseClass):
self.volume_size, json=True)
g.log.info("Heketi volume successfully created" % out)
volume_id = out["bricks"][0]["volume"]
- self.addCleanup(self.delete_volumes, volume_id)
+ self.addCleanup(
+ heketi_volume_delete, self.heketi_client_node,
+ self.heketi_server_url, volume_id)
g.log.info("List heketi volumes after volume creation")
h_vol_list = heketi_volume_list(
@@ -82,7 +85,9 @@ class TestHeketiVolume(HeketiBaseClass):
"volume of size %s" % self.volume_size))
g.log.info("Heketi volume successfully created" % out)
volume_id = out["bricks"][0]["volume"]
- self.addCleanup(self.delete_volumes, volume_id)
+ self.addCleanup(
+ heketi_volume_delete, self.heketi_client_node,
+ self.heketi_server_url, volume_id)
g.log.info("Retrieving heketi volume info")
out = heketi_volume_info(
@@ -112,7 +117,9 @@ class TestHeketiVolume(HeketiBaseClass):
"volume of size %s" % self.volume_size))
g.log.info("Heketi volume successfully created" % out)
volume_id = out["bricks"][0]["volume"]
- self.addCleanup(self.delete_volumes, volume_id)
+ self.addCleanup(
+ heketi_volume_delete, self.heketi_client_node,
+ self.heketi_server_url, volume_id)
# List heketi cluster's
g.log.info("Listing heketi cluster list")
@@ -154,7 +161,9 @@ class TestHeketiVolume(HeketiBaseClass):
self.assertTrue(vol, "Failed to create heketi volume.")
g.log.info("Heketi volume successfully created")
volume_id = vol["bricks"][0]["volume"]
- self.addCleanup(self.delete_volumes, volume_id)
+ self.addCleanup(
+ heketi_volume_delete, self.heketi_client_node,
+ self.heketi_server_url, volume_id)
# Pick up suitable node
node_ids = heketi_node_list(self.heketi_client_node, heketi_url)
diff --git a/tests/functional/common/heketi/heketi_tests/test_node_enable_disable.py b/tests/functional/common/heketi/heketi_tests/test_node_enable_disable.py
index 9fac9e01..b8ce2c71 100644
--- a/tests/functional/common/heketi/heketi_tests/test_node_enable_disable.py
+++ b/tests/functional/common/heketi/heketi_tests/test_node_enable_disable.py
@@ -1,16 +1,18 @@
"""Test cases to disable and enable node in heketi."""
import json
-from cnslibs.common.heketi_libs import HeketiBaseClass
+from cnslibs.common.baseclass import BaseClass
from cnslibs.common.heketi_ops import (heketi_node_enable,
heketi_node_info,
heketi_node_disable,
heketi_node_list,
- heketi_volume_create)
+ heketi_volume_create,
+ heketi_volume_delete
+ )
from glusto.core import Glusto as g
-class TestHeketiNodeState(HeketiBaseClass):
+class TestHeketiNodeState(BaseClass):
"""Test node enable and disable functionality."""
def enable_node(self, node_id):
@@ -107,9 +109,9 @@ class TestHeketiNodeState(HeketiBaseClass):
vol_info = heketi_volume_create(self.heketi_client_node,
self.heketi_server_url, vol_size,
json=True)
- self.assertTrue(vol_info, (
- "Failed to create heketi volume of size %d" % vol_size))
- self.addCleanup(self.delete_volumes, vol_info['id'])
+ self.addCleanup(
+ heketi_volume_delete, self.heketi_client_node,
+ self.heketi_server_url, vol_info['id'])
node_id = online_hosts[0]['id']
g.log.info("going to disable node id %s", node_id)
@@ -122,7 +124,9 @@ class TestHeketiNodeState(HeketiBaseClass):
vol_size, raw_cli_output=True)
if ret == 0:
out_json = json.loads(out)
- self.addCleanup(self.delete_volumes, out_json["id"])
+ self.addCleanup(
+ heketi_volume_delete, self.heketi_client_node,
+ self.heketi_server_url, out_json["id"])
self.assertNotEqual(ret, 0,
("Volume creation did not fail ret- %s "
"out- %s err- %s" % (ret, out, err)))
@@ -135,6 +139,6 @@ class TestHeketiNodeState(HeketiBaseClass):
vol_info = heketi_volume_create(self.heketi_client_node,
self.heketi_server_url, vol_size,
json=True)
- self.assertTrue(vol_info, (
- "Failed to create heketi volume of size %d" % vol_size))
- self.addCleanup(self.delete_volumes, vol_info['id'])
+ self.addCleanup(
+ heketi_volume_delete, self.heketi_client_node,
+ self.heketi_server_url, vol_info['id'])
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 3f956d62..ad60b844 100644
--- a/tests/functional/common/heketi/heketi_tests/test_node_info.py
+++ b/tests/functional/common/heketi/heketi_tests/test_node_info.py
@@ -2,11 +2,11 @@ from glusto.core import Glusto as g
from glustolibs.gluster.exceptions import ExecutionError
from glustolibs.gluster.peer_ops import get_pool_list
-from cnslibs.common.heketi_libs import HeketiBaseClass
+from cnslibs.common.baseclass import BaseClass
from cnslibs.common import heketi_ops, podcmd
-class TestHeketiVolume(HeketiBaseClass):
+class TestHeketiVolume(BaseClass):
"""
Class to test heketi volume create
"""