summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSri Vignesh <sselvan@redhat.com>2019-08-28 14:25:44 +0530
committervponomar <vponomar@redhat.com>2019-09-06 12:56:33 +0000
commitb1c89257407d0acfcfd12a59e4fcab728e268bac (patch)
tree20c4f6710e648c851e48db58a3c54a6c0cbf435c /tests
parentc99b48b2e11b4a4d84f5f5ca3ecefcb2d5e118f5 (diff)
Add testcase to validate creation of replica 2 volume
Verify creation of replica 2 volume and validate the bricks created in gluster backend are same. Change-Id: I9fcc090e909d9bf578cf8eca6e12e4f785140e3f Signed-off-by: Sri Vignesh <sselvan@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/heketi/test_volume_creation.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/functional/heketi/test_volume_creation.py b/tests/functional/heketi/test_volume_creation.py
index b2a3bdb4..7be97ff5 100644
--- a/tests/functional/heketi/test_volume_creation.py
+++ b/tests/functional/heketi/test_volume_creation.py
@@ -145,3 +145,33 @@ class TestVolumeCreationTestCases(BaseClass):
self.assertFalse(
vol_fail,
"Volume should have not been created. Out: %s" % vol_fail)
+
+ @podcmd.GlustoPod()
+ def test_volume_create_replica_2(self):
+ """Validate creation of a replica 2 volume"""
+ vol_create_info = heketi_ops.heketi_volume_create(
+ self.heketi_client_node, self.heketi_server_url, 1,
+ replica=2, json=True)
+ self.addCleanup(
+ heketi_ops.heketi_volume_delete, self.heketi_client_node,
+ self.heketi_server_url, vol_create_info["id"],
+ raise_on_error=True)
+ actual_replica = int(
+ vol_create_info["durability"]["replicate"]["replica"])
+ self.assertEqual(
+ actual_replica, 2,
+ "Volume '%s' has '%s' as value for replica,"
+ " expected 2." % (vol_create_info["id"], actual_replica))
+ vol_name = vol_create_info['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)
+
+ # Check amount of bricks
+ brick_amount = len(gluster_vol[vol_name]['bricks']['brick'])
+ self.assertEqual(brick_amount, 2,
+ "Brick amount is expected to be 2. "
+ "Actual amount is '%s'" % brick_amount)