diff options
Diffstat (limited to 'tests/functional/afr/test_client_side_quorum_with_fixed_for_cross3.py')
-rwxr-xr-x | tests/functional/afr/test_client_side_quorum_with_fixed_for_cross3.py | 139 |
1 files changed, 84 insertions, 55 deletions
diff --git a/tests/functional/afr/test_client_side_quorum_with_fixed_for_cross3.py b/tests/functional/afr/test_client_side_quorum_with_fixed_for_cross3.py index 3eea4894d..0ead8b2fc 100755 --- a/tests/functional/afr/test_client_side_quorum_with_fixed_for_cross3.py +++ b/tests/functional/afr/test_client_side_quorum_with_fixed_for_cross3.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2019 Red Hat, Inc. <http://www.redhat.com> +# Copyright (C) 2016-2020 Red Hat, Inc. <http://www.redhat.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,13 +17,16 @@ """ Description: Test Cases in this module tests the client side quorum. """ +from time import sleep from glusto.core import Glusto as g + from glustolibs.gluster.exceptions import ExecutionError from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on -from glustolibs.gluster.volume_libs import ( - set_volume_options, get_subvols) +from glustolibs.gluster.volume_libs import get_subvols from glustolibs.misc.misc_libs import upload_scripts +from glustolibs.gluster.volume_ops import (set_volume_options, + reset_volume_option) from glustolibs.gluster.brick_libs import (bring_bricks_offline, bring_bricks_online) from glustolibs.io.utils import (validate_io_procs, @@ -43,14 +46,14 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): Upload the necessary scripts to run tests. """ # calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Upload io scripts for running IO on mounts g.log.info("Upload io scripts to clients %s for running IO on " "mounts", cls.clients) - script_abs_path = "/usr/share/glustolibs/io/scripts/file_dir_ops.py" - cls.script_upload_path = script_abs_path - ret = upload_scripts(cls.clients, [script_abs_path]) + cls.script_upload_path = ("/usr/share/glustolibs/io/scripts/" + "file_dir_ops.py") + ret = upload_scripts(cls.clients, cls.script_upload_path) if not ret: raise ExecutionError("Failed to upload IO scripts to clients") @@ -59,7 +62,7 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): setUp method for every test """ # calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volume and Mount Volume g.log.info("Starting to Setup Volume %s", self.volname) @@ -72,6 +75,19 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): """ tearDown for every test """ + + # Reset the volume options set inside the test + g.log.info("Reset the volume options") + vol_options = ['cluster.self-heal-daemon', 'cluster.quorum-type', + 'cluster.quorum-count'] + for opt in vol_options: + ret, _, _ = reset_volume_option(self.mnode, self.volname, opt) + if ret != 0: + raise ExecutionError("Failed to reset the volume option %s" + % opt) + sleep(2) + g.log.info("Successfully reset the volume options") + # stopping the volume g.log.info("Starting to Unmount Volume and Cleanup Volume") ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts) @@ -81,7 +97,7 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): g.log.info("Successful in Unmount Volume and Cleanup Volume") # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_client_side_quorum_with_fixed_for_cross3(self): """ @@ -135,9 +151,10 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): # start I/O( write ) - must succeed all_mounts_procs = [] g.log.info("Starting IO on mountpoint %s", self.mounts[0].mountpoint) - cmd = ("python %s create_files " - "-f 10 --base-file-name file %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python %s create_files " + "-f 10 --base-file-name file %s" % ( + self.script_upload_path, + self.mounts[0].mountpoint)) proc = g.run_async(self.mounts[0].client_system, cmd, user=self.mounts[0].user) all_mounts_procs.append(proc) @@ -150,8 +167,9 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): # read the file g.log.info("Start reading files on %s", self.mounts[0].mountpoint) all_mounts_procs = [] - cmd = ("python %s read %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = "/usr/bin/env python %s read %s" % ( + self.script_upload_path, + self.mounts[0].mountpoint) proc = g.run_async(self.mounts[0].client_system, cmd, user=self.mounts[0].user) all_mounts_procs.append(proc) @@ -185,9 +203,10 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): # start I/0 ( write and read ) - must succeed g.log.info("Starting IO on mountpoint %s", self.mounts[0].mountpoint) all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 10 --base-file-name testfile %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python %s create_files " + "-f 10 --base-file-name testfile %s" % ( + self.script_upload_path, + self.mounts[0].mountpoint)) proc = g.run_async(self.mounts[0].client_system, cmd, user=self.mounts[0].user) all_mounts_procs.append(proc) @@ -201,8 +220,9 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): g.log.info("Start reading files on mountpoint %s", self.mounts[0].mountpoint) all_mounts_procs = [] - cmd = ("python %s read %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = "/usr/bin/env python %s read %s" % ( + self.script_upload_path, + self.mounts[0].mountpoint) proc = g.run_async(self.mounts[0].client_system, cmd, user=self.mounts[0].user) all_mounts_procs.append(proc) @@ -216,8 +236,7 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): offline_brick2_from_replicasets = [] for i in range(0, num_subvols): subvol_brick_list = subvols_dict['volume_subvols'][i] - g.log.info("sub-volume %s brick list : %s", - i, subvol_brick_list) + g.log.info("sub-volume %s brick list : %s", i, subvol_brick_list) brick_to_bring_offline2 = subvol_brick_list[1] g.log.info("Going to bring down the brick process " "for %s", brick_to_bring_offline2) @@ -231,9 +250,10 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): # start I/0 ( write and read ) - must succeed g.log.info("Starting IO on mountpoint %s", self.mounts[0].mountpoint) all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 10 --base-file-name newfile %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python %s create_files " + "-f 10 --base-file-name newfile %s" % ( + self.script_upload_path, + self.mounts[0].mountpoint)) proc = g.run_async(self.mounts[0].client_system, cmd, user=self.mounts[0].user) all_mounts_procs.append(proc) @@ -247,8 +267,9 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): g.log.info("Start reading files on mountpoint %s", self.mounts[0].mountpoint) all_mounts_procs = [] - cmd = ("python %s read %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = "/usr/bin/env python %s read %s" % ( + self.script_upload_path, + self.mounts[0].mountpoint) proc = g.run_async(self.mounts[0].client_system, cmd, user=self.mounts[0].user) all_mounts_procs.append(proc) @@ -269,9 +290,10 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): # start I/0 ( write and read ) - must succeed g.log.info("Starting IO on mountpoint %s", self.mounts[0].mountpoint) all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 10 --base-file-name filename %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python %s create_files " + "-f 10 --base-file-name filename %s" % ( + self.script_upload_path, + self.mounts[0].mountpoint)) proc = g.run_async(self.mounts[0].client_system, cmd, user=self.mounts[0].user) all_mounts_procs.append(proc) @@ -285,8 +307,9 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): g.log.info("Start reading files on mountpoint %s", self.mounts[0].mountpoint) all_mounts_procs = [] - cmd = ("python %s read %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = "/usr/bin/env python %s read %s" % ( + self.script_upload_path, + self.mounts[0].mountpoint) proc = g.run_async(self.mounts[0].client_system, cmd, user=self.mounts[0].user) all_mounts_procs.append(proc) @@ -346,8 +369,7 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): g.log.info("bringing up the brick : %s online", offline_brick1_from_replicasets) ret = bring_bricks_online( - self.mnode, self.volname, - offline_brick1_from_replicasets, + self.mnode, self.volname, offline_brick1_from_replicasets, bring_bricks_online_methods='glusterd_restart') self.assertTrue(ret, ("Failed to brought the brick %s online" % offline_brick1_from_replicasets)) @@ -357,9 +379,10 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): # start I/0 ( write and read ) - must succeed g.log.info("Starting IO on mountpoint %s", self.mounts[0].mountpoint) all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 10 --base-file-name newfilename %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python %s create_files " + "-f 10 --base-file-name newfilename %s" % ( + self.script_upload_path, + self.mounts[0].mountpoint)) proc = g.run_async(self.mounts[0].client_system, cmd, user=self.mounts[0].user) all_mounts_procs.append(proc) @@ -373,8 +396,9 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): g.log.info("Start reading files on mountpoint %s", self.mounts[0].mountpoint) all_mounts_procs = [] - cmd = ("python %s read %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = "/usr/bin/env python %s read %s" % ( + self.script_upload_path, + self.mounts[0].mountpoint) proc = g.run_async(self.mounts[0].client_system, cmd, user=self.mounts[0].user) all_mounts_procs.append(proc) @@ -388,8 +412,7 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): g.log.info("bringing up the brick : %s online", offline_brick2_from_replicasets) ret = bring_bricks_online( - self.mnode, self.volname, - offline_brick2_from_replicasets, + self.mnode, self.volname, offline_brick2_from_replicasets, bring_bricks_online_methods='glusterd_restart') self.assertTrue(ret, ("Failed to brought the brick %s online" % offline_brick2_from_replicasets)) @@ -399,9 +422,10 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): # start I/0 ( write and read ) - must succeed g.log.info("Starting IO on mountpoint %s", self.mounts[0].mountpoint) all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 10 --base-file-name textfile %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python %s create_files " + "-f 10 --base-file-name textfile %s" % ( + self.script_upload_path, + self.mounts[0].mountpoint)) proc = g.run_async(self.mounts[0].client_system, cmd, user=self.mounts[0].user) all_mounts_procs.append(proc) @@ -415,8 +439,9 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): g.log.info("Start reading files on mountpoint %s", self.mounts[0].mountpoint) all_mounts_procs = [] - cmd = ("python %s read %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = "/usr/bin/env python %s read %s" % ( + self.script_upload_path, + self.mounts[0].mountpoint) proc = g.run_async(self.mounts[0].client_system, cmd, user=self.mounts[0].user) all_mounts_procs.append(proc) @@ -437,9 +462,10 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): # start I/0 ( write and read ) - must succeed g.log.info("Starting IO on mountpoint %s", self.mounts[0].mountpoint) all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 10 --base-file-name newtextfile %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python %s create_files " + "-f 10 --base-file-name newtextfile %s" % ( + self.script_upload_path, + self.mounts[0].mountpoint)) proc = g.run_async(self.mounts[0].client_system, cmd, user=self.mounts[0].user) all_mounts_procs.append(proc) @@ -453,8 +479,9 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): g.log.info("Start reading files on mountpoint %s", self.mounts[0].mountpoint) all_mounts_procs = [] - cmd = ("python %s read %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = "/usr/bin/env python %s read %s" % ( + self.script_upload_path, + self.mounts[0].mountpoint) proc = g.run_async(self.mounts[0].client_system, cmd, user=self.mounts[0].user) all_mounts_procs.append(proc) @@ -623,9 +650,10 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): # start I/0 ( write and read ) - must succeed g.log.info("Starting IO on mountpoint %s", self.mounts[0].mountpoint) all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 10 --base-file-name lastfile %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python %s create_files " + "-f 10 --base-file-name lastfile %s" % ( + self.script_upload_path, + self.mounts[0].mountpoint)) proc = g.run_async(self.mounts[0].client_system, cmd, user=self.mounts[0].user) all_mounts_procs.append(proc) @@ -639,8 +667,9 @@ class ClientSideQuorumTestsWithSingleVolumeCross3(GlusterBaseClass): g.log.info("Start reading files on mountpoint %s", self.mounts[0].mountpoint) all_mounts_procs = [] - cmd = ("python %s read %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = "/usr/bin/env python %s read %s" % ( + self.script_upload_path, + self.mounts[0].mountpoint) proc = g.run_async(self.mounts[0].client_system, cmd, user=self.mounts[0].user) all_mounts_procs.append(proc) |