summaryrefslogtreecommitdiffstats
path: root/tests/functional/heketi
diff options
context:
space:
mode:
authorSri Vignesh <sselvan@redhat.com>2019-09-17 17:15:36 +0530
committervponomar <vponomar@redhat.com>2019-11-14 12:39:31 +0000
commit9301272995683106c100cffbc550fff6c5b94015 (patch)
tree25d4404943f777f362393e80e4cb162a977a06e3 /tests/functional/heketi
parent325253963d053378495552ae1c0e54062c6b1291 (diff)
Add testcase to create volume with snapshot enabled
Validate creation of volume with snapshot enabled and create and delete snapshot created. Change-Id: I7173ed6fb6659963e29cc0f1b1ede0ce7c6fe2a4 Signed-off-by: Sri Vignesh <sselvan@redhat.com>
Diffstat (limited to 'tests/functional/heketi')
-rw-r--r--tests/functional/heketi/test_volume_creation.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/functional/heketi/test_volume_creation.py b/tests/functional/heketi/test_volume_creation.py
index 7be97ff5..0e444edb 100644
--- a/tests/functional/heketi/test_volume_creation.py
+++ b/tests/functional/heketi/test_volume_creation.py
@@ -1,4 +1,5 @@
from glusto.core import Glusto as g
+from glustolibs.gluster import snap_ops
from glustolibs.gluster import volume_ops
from openshiftstoragelibs.baseclass import BaseClass
@@ -175,3 +176,41 @@ class TestVolumeCreationTestCases(BaseClass):
self.assertEqual(brick_amount, 2,
"Brick amount is expected to be 2. "
"Actual amount is '%s'" % brick_amount)
+
+ @podcmd.GlustoPod()
+ def test_volume_create_snapshot_enabled(self):
+ """Validate volume creation with snapshot enabled"""
+ factor = 1.5
+ vol_create_info = heketi_ops.heketi_volume_create(
+ self.heketi_client_node, self.heketi_server_url, 1,
+ snapshot_factor=factor, json=True)
+ self.addCleanup(
+ heketi_ops.heketi_volume_delete, self.heketi_client_node,
+ self.heketi_server_url, vol_create_info["id"])
+ snap_factor_count = vol_create_info["snapshot"]["factor"]
+ self.assertEqual(
+ snap_factor_count, factor,
+ "snapshot factor %s is not same as %s" % (
+ snap_factor_count, factor))
+
+ vol_name, snap_name = vol_create_info["name"], "snap1"
+ try:
+ ret, out, err = snap_ops.snap_create(
+ 'auto_get_gluster_endpoint', vol_name,
+ snap_name, timestamp=False)
+ self.assertEqual(
+ ret, 0, "Failed to create snapshot %s" % snap_name)
+
+ # Get gluster volume info
+ gluster_vol = volume_ops.get_volume_info(
+ 'auto_get_gluster_endpoint', volname=vol_name)
+ self.assertTrue(
+ gluster_vol, "Failed to get volume '%s' info" % vol_name)
+ self.assertEqual(
+ gluster_vol[vol_name]['snapshotCount'], "1",
+ "Failed to get snapshot count for volume %s" % vol_name)
+ finally:
+ ret, out, err = snap_ops.snap_delete(
+ 'auto_get_gluster_endpoint', snap_name)
+ self.assertEqual(
+ ret, 0, "Failed to delete snapshot %s" % snap_name)