diff options
author | Nitin Goyal <nigoyal@redhat.com> | 2019-11-20 14:19:53 +0530 |
---|---|---|
committer | vponomar <vponomar@redhat.com> | 2019-11-21 14:48:45 +0000 |
commit | 35958d4622eae5fe2f127e9a2c3e4bce8263346e (patch) | |
tree | 431e91c759125d5b95207efb1137139c9328da6d /tests | |
parent | 74ea70f8b8de5c86da992c13f0f60329d092e019 (diff) |
Add new TC verify PID's of gluster volume
Add new TC where it will verify PID's of gluster volumes are same when
volume options value is different.
Change-Id: Ie0cae1ad3fdfd35e4c0e7f01e3a048b62b185369
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functional/gluster_stability/test_brickmux_stability.py | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/functional/gluster_stability/test_brickmux_stability.py b/tests/functional/gluster_stability/test_brickmux_stability.py new file mode 100644 index 00000000..a3fffe3c --- /dev/null +++ b/tests/functional/gluster_stability/test_brickmux_stability.py @@ -0,0 +1,72 @@ +from openshiftstoragelibs.baseclass import BaseClass +from openshiftstoragelibs.gluster_ops import ( + get_gluster_vol_status, +) +from openshiftstoragelibs.heketi_ops import ( + heketi_node_disable, + heketi_node_enable, + heketi_node_list, +) +from openshiftstoragelibs.openshift_ops import ( + get_gluster_vol_info_by_pvc_name, +) + + +class TestBrickMux(BaseClass): + ''' + Class that contains BrickMux test cases. + ''' + + def setUp(self): + super(TestBrickMux, self).setUp() + self.node = self.ocp_master_node[0] + + def test_brick_multiplex_pids_with_diff_vol_option_values(self): + """Test Brick Pid's should be same when values of vol options are diff + """ + h_client, h_url = self.heketi_client_node, self.heketi_server_url + # Disable heketi nodes except first three nodes + h_nodes_list = heketi_node_list(h_client, h_url) + for node_id in h_nodes_list[3:]: + heketi_node_disable(h_client, h_url, node_id) + self.addCleanup(heketi_node_enable, h_client, h_url, node_id) + + # Create storage class with diff volumeoptions + sc1 = self.create_storage_class(volumeoptions='user.heketi.abc 1') + sc2 = self.create_storage_class(volumeoptions='user.heketi.abc 2') + # Create PVC's with above SC + pvc1 = self.create_and_wait_for_pvcs(sc_name=sc1) + pvc2 = self.create_and_wait_for_pvcs(sc_name=sc2) + + # Get vol info and status + vol_info1 = get_gluster_vol_info_by_pvc_name(self.node, pvc1[0]) + vol_info2 = get_gluster_vol_info_by_pvc_name(self.node, pvc2[0]) + vol_status1 = get_gluster_vol_status(vol_info1['gluster_vol_id']) + vol_status2 = get_gluster_vol_status(vol_info2['gluster_vol_id']) + + # Verify vol options + err_msg = ('Volume option "user.heketi.abc %s" did not got match for ' + 'volume %s in gluster vol info') + self.assertEqual( + vol_info1['options']['user.heketi.abc'], '1', + err_msg % (1, vol_info1['gluster_vol_id'])) + self.assertEqual( + vol_info2['options']['user.heketi.abc'], '2', + err_msg % (2, vol_info2['gluster_vol_id'])) + + # Get the PID's and match them + pids1 = set() + for brick in vol_info1['bricks']['brick']: + host, bname = brick['name'].split(":") + pids1.add(vol_status1[host][bname]['pid']) + + pids2 = set() + for brick in vol_info2['bricks']['brick']: + host, bname = brick['name'].split(":") + pids2.add(vol_status2[host][bname]['pid']) + + err_msg = ('Pids of both the volumes %s and %s are expected to be' + 'same. But got the different Pids "%s" and "%s".' % + (vol_info1['gluster_vol_id'], vol_info2['gluster_vol_id'], + pids1, pids2)) + self.assertEqual(pids1, pids2, err_msg) |