From b1c89257407d0acfcfd12a59e4fcab728e268bac Mon Sep 17 00:00:00 2001 From: Sri Vignesh Date: Wed, 28 Aug 2019 14:25:44 +0530 Subject: 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 --- tests/functional/heketi/test_volume_creation.py | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) 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) -- cgit