From b1dfa315487c2da399988775e5de39354f686b0c Mon Sep 17 00:00:00 2001 From: Valerii Ponomarov Date: Wed, 11 Dec 2019 21:06:59 +0530 Subject: [py2to3] Add py3 support for tests in 'tests/functional/afr' Change-Id: Ic14be81f1cd42c470d2bb5c15505fc1bc168a393 Signed-off-by: Valerii Ponomarov --- .../afr/heal/test_no_glustershd_with_distribute.py | 16 +- .../functional/afr/test_afr_cli_gfid_splitbrain.py | 21 ++- .../afr/test_afr_cli_no_splitbrain_resolution.py | 21 ++- ..._process_not_started_on_read_only_node_disks.py | 20 ++- .../test_client_side_quorum_with_auto_option.py | 16 +- ...side_quorum_with_auto_option_overwrite_fixed.py | 23 +-- .../afr/test_client_side_quorum_with_cross2.py | 163 ++++++++++++--------- ...est_client_side_quorum_with_fixed_for_cross3.py | 105 +++++++------ ...t_side_quorum_with_fixed_validate_max_bricks.py | 6 +- ...est_client_side_quorum_with_multiple_volumes.py | 18 ++- ...est_conservative_merge_of_files_heal_command.py | 30 ++-- ...t_to_repl_automatic_heal_should_be_triggered.py | 22 ++- .../afr/test_file_permission_and_mode.py | 4 +- .../afr/test_gfid_assignment_on_dist_rep_vol.py | 12 +- .../afr/test_gfid_assignment_on_lookup.py | 4 +- tests/functional/afr/test_gfid_heal.py | 7 +- .../afr/test_gfid_split_brain_resolution.py | 6 +- .../afr/test_glustershd_on_all_volume_types.py | 6 +- .../afr/test_glustershd_on_newly_probed_server.py | 12 +- ...est_heal_command_unsuccessful_as_bricks_down.py | 6 +- tests/functional/afr/test_heal_fail_1x3.py | 21 ++- .../afr/test_heal_info_should_have_fixed_fields.py | 20 ++- .../afr/test_manual_heal_should_trigger_heal.py | 16 +- ...est_multiple_clients_dd_on_same_file_default.py | 14 +- .../functional/afr/test_quota_limit_entry_heal.py | 7 +- tests/functional/afr/test_readlink.py | 6 +- .../afr/test_self_heal_when_dir_quota_exceeded.py | 13 +- .../afr/test_self_heal_with_quota_object_limit.py | 25 ++-- ...test_shd_should_not_crash_executed_heal_info.py | 25 ++-- tests/functional/afr/test_volume_set_options.py | 12 +- ...write_io_mount_point_resumed_quorum_restored.py | 15 +- 31 files changed, 408 insertions(+), 284 deletions(-) (limited to 'tests/functional/afr') diff --git a/tests/functional/afr/heal/test_no_glustershd_with_distribute.py b/tests/functional/afr/heal/test_no_glustershd_with_distribute.py index fdf818abd..d2b43bfe3 100644 --- a/tests/functional/afr/heal/test_no_glustershd_with_distribute.py +++ b/tests/functional/afr/heal/test_no_glustershd_with_distribute.py @@ -144,10 +144,10 @@ class SelfHealDaemonProcessTestsWithMultipleVolumes(GlusterBaseClass): self.assertFalse(ret, ("Self heal daemon process is still running " "after stopping all volumes ")) for node in pids: - self.assertEquals(pids[node][0], -1, ("Self heal daemon is still " - "running on node %s even " - "after stoppong all " - "volumes" % node)) + self.assertEqual(pids[node][0], -1, ("Self heal daemon is still " + "running on node %s even " + "after stoppong all " + "volumes" % node)) g.log.info("EXPECTED: No self heal daemon process is " "running after stopping all volumes") @@ -169,9 +169,9 @@ class SelfHealDaemonProcessTestsWithMultipleVolumes(GlusterBaseClass): self.assertFalse(ret, ("Self heal daemon process is still running " "after stopping all volumes ")) for node in pids: - self.assertEquals(pids[node][0], -1, ("Self heal daemon is still " - "running on node %s even " - "after stopping all " - "volumes" % node)) + self.assertEqual(pids[node][0], -1, ("Self heal daemon is still " + "running on node %s even " + "after stopping all " + "volumes" % node)) g.log.info("EXPECTED: No self heal daemon process is running " "after stopping all volumes") diff --git a/tests/functional/afr/test_afr_cli_gfid_splitbrain.py b/tests/functional/afr/test_afr_cli_gfid_splitbrain.py index ec3f803e9..324f47f6a 100644 --- a/tests/functional/afr/test_afr_cli_gfid_splitbrain.py +++ b/tests/functional/afr/test_afr_cli_gfid_splitbrain.py @@ -16,7 +16,10 @@ # pylint: disable=too-many-statements, too-many-locals +import sys + 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.brick_libs import (get_all_bricks, @@ -38,7 +41,7 @@ class TestSelfHeal(GlusterBaseClass): def setUpClass(cls): # 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 " @@ -79,7 +82,7 @@ class TestSelfHeal(GlusterBaseClass): raise ExecutionError("Failed to create volume") g.log.info("Successful in cleaning up Volume %s", cls.volname) - GlusterBaseClass.tearDownClass.im_func(cls) + cls.get_super_method(cls, 'tearDownClass')() def test_afr_gfid_heal(self): @@ -111,9 +114,10 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("creating a file from mount point") all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 1 --base-file-name test_file --fixed-file-size 1k %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files " + "-f 1 --base-file-name test_file --fixed-file-size 1k %s" % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint)) proc = g.run_async(self.mounts[0].client_system, cmd) all_mounts_procs.append(proc) # Validate I/O @@ -137,9 +141,10 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("creating a new file of same name from mount point") all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 1 --base-file-name test_file --fixed-file-size 1k %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files " + "-f 1 --base-file-name test_file --fixed-file-size 1k %s" % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint)) proc = g.run_async(self.mounts[0].client_system, cmd) all_mounts_procs.append(proc) # Validate I/O diff --git a/tests/functional/afr/test_afr_cli_no_splitbrain_resolution.py b/tests/functional/afr/test_afr_cli_no_splitbrain_resolution.py index e9a6681f4..11ca0dd77 100644 --- a/tests/functional/afr/test_afr_cli_no_splitbrain_resolution.py +++ b/tests/functional/afr/test_afr_cli_no_splitbrain_resolution.py @@ -16,7 +16,10 @@ # pylint: disable=too-many-statements, too-many-locals, unused-variable +import sys + 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.brick_libs import (get_all_bricks, @@ -41,7 +44,7 @@ class TestSelfHeal(GlusterBaseClass): def setUpClass(cls): # 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 " @@ -82,7 +85,7 @@ class TestSelfHeal(GlusterBaseClass): raise ExecutionError("Failed to create volume") g.log.info("Successful in cleaning up Volume %s", cls.volname) - GlusterBaseClass.tearDownClass.im_func(cls) + cls.get_super_method(cls, 'tearDownClass')() def test_afr_gfid_heal(self): @@ -115,9 +118,10 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("creating 5 files from mount point") all_mounts_procs = [] for mount_obj in self.mounts: - cmd = ("python %s create_files " - "-f 5 --base-file-name test_file --fixed-file-size 1k %s" - % (self.script_upload_path, mount_obj.mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files -f 5 " + "--base-file-name test_file --fixed-file-size 1k %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) all_mounts_procs.append(proc) @@ -151,9 +155,10 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("creating 5 new files of same name from mount point") all_mounts_procs = [] for mount_obj in self.mounts: - cmd = ("python %s create_files " - "-f 5 --base-file-name test_file --fixed-file-size 10k %s" - % (self.script_upload_path, mount_obj.mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files -f 5 " + "--base-file-name test_file --fixed-file-size 10k %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) all_mounts_procs.append(proc) diff --git a/tests/functional/afr/test_brick_process_not_started_on_read_only_node_disks.py b/tests/functional/afr/test_brick_process_not_started_on_read_only_node_disks.py index df75b771a..a3e7f05dc 100644 --- a/tests/functional/afr/test_brick_process_not_started_on_read_only_node_disks.py +++ b/tests/functional/afr/test_brick_process_not_started_on_read_only_node_disks.py @@ -1,6 +1,9 @@ import calendar +import sys import time + 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.brick_libs import (bring_bricks_offline, @@ -26,7 +29,7 @@ class SelfHealDaemonProcessTests(GlusterBaseClass): @classmethod def setUpClass(cls): # 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", @@ -49,7 +52,7 @@ class SelfHealDaemonProcessTests(GlusterBaseClass): """ # calling GlusterBaseClass setUpClass - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() self.all_mounts_procs = [] self.io_validation_complete = False @@ -92,7 +95,7 @@ class SelfHealDaemonProcessTests(GlusterBaseClass): g.log.info("Successful in Unmount Volume and Cleanup Volume") # calling GlusterBaseClass tearDownClass - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_brick_process_not_started_on_read_only_node_disks(self): """ @@ -111,10 +114,10 @@ class SelfHealDaemonProcessTests(GlusterBaseClass): # Select bricks to bring offline bricks_to_bring_offline_dict = (select_bricks_to_bring_offline( self.mnode, self.volname)) - bricks_to_bring_offline = filter(None, ( + bricks_to_bring_offline = list(filter(None, ( bricks_to_bring_offline_dict['hot_tier_bricks'] + bricks_to_bring_offline_dict['cold_tier_bricks'] + - bricks_to_bring_offline_dict['volume_bricks'])) + bricks_to_bring_offline_dict['volume_bricks']))) # Bring brick offline g.log.info('Bringing bricks %s offline...', bricks_to_bring_offline) @@ -133,9 +136,10 @@ class SelfHealDaemonProcessTests(GlusterBaseClass): for mount_obj in self.mounts: g.log.info("Starting IO on %s:%s", mount_obj.client_system, mount_obj.mountpoint) - cmd = ("python %s create_files -f 100 %s/%s/test_dir" - % (self.script_upload_path, mount_obj.mountpoint, - mount_obj.client_system)) + cmd = ("/usr/bin/env python%d %s create_files -f 100 " + "%s/%s/test_dir" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint, mount_obj.client_system)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) self.all_mounts_procs.append(proc) diff --git a/tests/functional/afr/test_client_side_quorum_with_auto_option.py b/tests/functional/afr/test_client_side_quorum_with_auto_option.py index 79e167f9d..ff52c58bd 100755 --- a/tests/functional/afr/test_client_side_quorum_with_auto_option.py +++ b/tests/functional/afr/test_client_side_quorum_with_auto_option.py @@ -18,7 +18,10 @@ Test Cases in this module tests the client side quorum. """ +import sys + 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 ( @@ -42,7 +45,7 @@ class ClientSideQuorumTests(GlusterBaseClass): """ # 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 " @@ -55,7 +58,7 @@ class ClientSideQuorumTests(GlusterBaseClass): def setUp(self): # 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) @@ -73,7 +76,7 @@ class ClientSideQuorumTests(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_auto_option(self): """ @@ -98,9 +101,10 @@ class ClientSideQuorumTests(GlusterBaseClass): # write files on all mounts g.log.info("Starting IO on all mounts...") g.log.info("mounts: %s", self.mounts) - 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%d %s create_files " + "-f 10 --base-file-name file %s" % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint)) ret, _, err = g.run(self.mounts[0].client_system, cmd) self.assertFalse(ret, "IO failed on %s with %s" % (self.mounts[0].client_system, err)) diff --git a/tests/functional/afr/test_client_side_quorum_with_auto_option_overwrite_fixed.py b/tests/functional/afr/test_client_side_quorum_with_auto_option_overwrite_fixed.py index 77884bd4d..0dab6d09a 100755 --- a/tests/functional/afr/test_client_side_quorum_with_auto_option_overwrite_fixed.py +++ b/tests/functional/afr/test_client_side_quorum_with_auto_option_overwrite_fixed.py @@ -18,7 +18,10 @@ Test Cases in this module tests the client side quorum. """ +import sys + 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 ( @@ -43,7 +46,7 @@ class ClientSideQuorumTests(GlusterBaseClass): """ # 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 " @@ -60,7 +63,7 @@ class ClientSideQuorumTests(GlusterBaseClass): """ # 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) @@ -82,7 +85,7 @@ class ClientSideQuorumTests(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_auto_option_overwrite_fixed(self): """ @@ -150,9 +153,10 @@ class ClientSideQuorumTests(GlusterBaseClass): # create files g.log.info("Starting IO on all mounts...") g.log.info("mounts: %s", self.mounts) - 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%d %s create_files " + "-f 10 --base-file-name file %s" % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint)) ret, _, err = g.run(self.mounts[0].client_system, cmd) self.assertFalse(ret, "IO failed on %s with '%s'" % (self.mounts[0].client_system, err)) @@ -181,9 +185,10 @@ class ClientSideQuorumTests(GlusterBaseClass): # create files g.log.info("Starting IO on all mounts...") g.log.info("mounts: %s", self.mounts) - cmd = ("python %s create_files " - "-f 10 --base-file-name second_file %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files " + "-f 10 --base-file-name second_file %s" % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint)) ret, _, err = g.run(self.mounts[0].client_system, cmd) self.assertFalse(ret, "IO failed on %s with '%s'" % (self.mounts[0].client_system, err)) diff --git a/tests/functional/afr/test_client_side_quorum_with_cross2.py b/tests/functional/afr/test_client_side_quorum_with_cross2.py index 142fcb886..a12093ae0 100644 --- a/tests/functional/afr/test_client_side_quorum_with_cross2.py +++ b/tests/functional/afr/test_client_side_quorum_with_cross2.py @@ -18,7 +18,10 @@ Test Cases in this module tests the client side quorum. """ +import sys + 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 ( @@ -41,7 +44,7 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): @classmethod def setUpClass(cls): # 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", @@ -79,7 +82,7 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): """ # 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) @@ -101,7 +104,7 @@ class ClientSideQuorumCross2Tests(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_auto_option_cross2(self): """ @@ -126,9 +129,10 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): # Start IO on mounts g.log.info("Starting IO .....") all_mounts_procs = [] - 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%d %s create_files " + "-f 10 --base-file-name file %s" % ( + sys.version_info.major, 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) @@ -163,9 +167,10 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): # create new file named newfile0.txt g.log.info("Start creating new file on all mounts...") all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 1 --base-file-name newfile %s" % - (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files " + "-f 1 --base-file-name newfile %s" % ( + sys.version_info.major, 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) @@ -179,8 +184,9 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): # create directory user1 g.log.info("Start creating directory on all mounts...") all_mounts_procs = [] - cmd = ("python %s create_deep_dir %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = "/usr/bin/env python%d %s create_deep_dir %s" % ( + sys.version_info.major, 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) @@ -249,8 +255,9 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): g.log.info("Starting reading files on all mounts") all_mounts_procs = [] for mount_obj in self.mounts: - cmd = ("python %s read %s" - % (self.script_upload_path, mount_obj.mountpoint)) + cmd = "/usr/bin/env python%d %s read %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) all_mounts_procs.append(proc) @@ -274,8 +281,9 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): # stat on dir g.log.info("stat on directory on all mounts") for mount_obj in self.mounts: - cmd = ("python %s stat %s" - % (self.script_upload_path, mount_obj.mountpoint)) + cmd = "/usr/bin/env python%d %s stat %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint) ret, _, _ = g.run(mount_obj.client_system, cmd) self.assertFalse(ret, 'Failed to stat directory on %s' % mount_obj.mountpoint) @@ -285,8 +293,9 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): # ls on mount point g.log.info("ls on mount point on all mounts") for mount_obj in self.mounts: - cmd = ("python %s ls %s" - % (self.script_upload_path, mount_obj.mountpoint)) + cmd = "/usr/bin/env python%d %s ls %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint) ret, _, _ = g.run(mount_obj.client_system, cmd) self.assertFalse(ret, 'Failed to ls on %s' % mount_obj.mountpoint) @@ -353,9 +362,10 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): g.log.info("Starting IO on all mounts...") g.log.info("mounts: %s", self.mounts) all_mounts_procs = [] - 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%d %s create_files " + "-f 10 --base-file-name file %s" % ( + sys.version_info.major, 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) @@ -370,8 +380,9 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): g.log.info("Start reading files on all mounts") all_mounts_procs = [] for mount_obj in self.mounts: - cmd = ("python %s read " - "%s" % (self.script_upload_path, mount_obj.mountpoint)) + cmd = "/usr/bin/env python%d %s read %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) all_mounts_procs.append(proc) @@ -409,9 +420,10 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): g.log.info("Starting IO on all mounts...") g.log.info("mounts: %s", self.mounts) all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 10 --base-file-name second_file %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files " + "-f 10 --base-file-name second_file %s" % ( + sys.version_info.major, 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) @@ -426,8 +438,9 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): g.log.info("Start reading files on all mounts") all_mounts_procs = [] for mount_obj in self.mounts: - cmd = ("python %s read " - "%s" % (self.script_upload_path, mount_obj.mountpoint)) + cmd = "/usr/bin/env python%d %s read %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) all_mounts_procs.append(proc) @@ -450,9 +463,10 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): # start I/0 ( write and read ) - must succeed g.log.info("Starting IO on mount.....") all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 10 --base-file-name third_file %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files " + "-f 10 --base-file-name third_file %s" % ( + sys.version_info.major, 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) @@ -467,8 +481,9 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): g.log.info("Start reading files on all mounts") all_mounts_procs = [] for mount_obj in self.mounts: - cmd = ("python %s read " - "%s" % (self.script_upload_path, mount_obj.mountpoint)) + cmd = "/usr/bin/env python%d %s read %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) all_mounts_procs.append(proc) @@ -491,9 +506,10 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): # start I/0 ( write and read ) - read must pass, write will fail g.log.info("Starting IO on mount......") all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 10 --base-file-name fourth_file %s" % - (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files " + "-f 10 --base-file-name fourth_file %s" % ( + sys.version_info.major, 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) @@ -510,8 +526,9 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): g.log.info("Start reading files on all mounts") all_mounts_procs = [] for mount_obj in self.mounts: - cmd = ("python %s read " - "%s" % (self.script_upload_path, mount_obj.mountpoint)) + cmd = "/usr/bin/env python%d %s read %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) all_mounts_procs.append(proc) @@ -535,9 +552,10 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): # start I/0 ( write and read ) - must succeed g.log.info("Starting IO on mount.....") all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 10 --base-file-name fifth_file %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files " + "-f 10 --base-file-name fifth_file %s" % ( + sys.version_info.major, 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) @@ -552,8 +570,9 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): g.log.info("Start reading files on all mounts") all_mounts_procs = [] for mount_obj in self.mounts: - cmd = ("python %s read " - "%s" % (self.script_upload_path, mount_obj.mountpoint)) + cmd = "/usr/bin/env python%d %s read %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) all_mounts_procs.append(proc) @@ -576,9 +595,10 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): # start I/0 ( write and read ) - read must pass, write will fail g.log.info("Start creating files on mounts.....") all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 10 --base-file-name sixth_file %s" % - (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files " + "-f 10 --base-file-name sixth_file %s" % ( + sys.version_info.major, 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) @@ -595,8 +615,9 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): g.log.info("Start reading files on all mounts") all_mounts_procs = [] for mount_obj in self.mounts: - cmd = ("python %s read " - "%s" % (self.script_upload_path, mount_obj.mountpoint)) + cmd = "/usr/bin/env python%d %s read %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) all_mounts_procs.append(proc) @@ -619,9 +640,10 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): # start I/0 ( write and read ) - must succeed g.log.info("Starting IO on mount.....") all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 10 --base-file-name seventh_file %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files " + "-f 10 --base-file-name seventh_file %s" % ( + sys.version_info.major, 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) @@ -636,8 +658,9 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): g.log.info("Start reading files on all mounts") all_mounts_procs = [] for mount_obj in self.mounts: - cmd = ("python %s read " - "%s" % (self.script_upload_path, mount_obj.mountpoint)) + cmd = "/usr/bin/env python%d %s read %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) all_mounts_procs.append(proc) @@ -661,9 +684,10 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): # start I/0 ( write and read ) - must succeed g.log.info("Starting IO on mount.....") all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 10 --base-file-name eigth_file %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files " + "-f 10 --base-file-name eigth_file %s" % ( + sys.version_info.major, 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) @@ -678,8 +702,9 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): g.log.info("Start reading files on all mounts") all_mounts_procs = [] for mount_obj in self.mounts: - cmd = ("python %s read " - "%s" % (self.script_upload_path, mount_obj.mountpoint)) + cmd = "/usr/bin/env python%d %s read %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) all_mounts_procs.append(proc) @@ -712,9 +737,10 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): # start I/0 ( write and read ) - read must pass, write will fail g.log.info("Start creating files on mounts.....") all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 10 --base-file-name ninth_file %s" % - (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files " + "-f 10 --base-file-name ninth_file %s" % ( + sys.version_info.major, 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) @@ -731,8 +757,9 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): g.log.info("Start reading files on all mounts") all_mounts_procs = [] for mount_obj in self.mounts: - cmd = ("python %s read " - "%s" % (self.script_upload_path, mount_obj.mountpoint)) + cmd = "/usr/bin/env python%d %s read %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) all_mounts_procs.append(proc) @@ -755,9 +782,10 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): # start I/0 ( write and read ) - must succeed g.log.info("Starting IO on mount.....") all_mounts_procs = [] - cmd = ("python %s create_files " - "-f 10 --base-file-name tenth_file %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files " + "-f 10 --base-file-name tenth_file %s" % ( + sys.version_info.major, 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) @@ -772,8 +800,9 @@ class ClientSideQuorumCross2Tests(GlusterBaseClass): g.log.info("Start reading files on all mounts") all_mounts_procs = [] for mount_obj in self.mounts: - cmd = ("python %s read " - "%s" % (self.script_upload_path, mount_obj.mountpoint)) + cmd = "/usr/bin/env python%d %s read %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) all_mounts_procs.append(proc) 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 e074460e0..eb8724dda 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 @@ -18,8 +18,11 @@ Test Cases in this module tests the client side quorum. """ +import sys 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 ( @@ -45,7 +48,7 @@ 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 " @@ -61,7 +64,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) @@ -96,7 +99,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): """ @@ -150,9 +153,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%d %s create_files " + "-f 10 --base-file-name file %s" % ( + sys.version_info.major, 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) @@ -165,8 +169,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%d %s read %s" % ( + sys.version_info.major, 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) @@ -200,9 +205,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%d %s create_files " + "-f 10 --base-file-name testfile %s" % ( + sys.version_info.major, 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 +222,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%d %s read %s" % ( + sys.version_info.major, 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) @@ -245,9 +252,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%d %s create_files " + "-f 10 --base-file-name newfile %s" % ( + sys.version_info.major, 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) @@ -261,8 +269,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%d %s read %s" % ( + sys.version_info.major, 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) @@ -283,9 +292,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%d %s create_files " + "-f 10 --base-file-name filename %s" % ( + sys.version_info.major, 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) @@ -299,8 +309,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%d %s read %s" % ( + sys.version_info.major, 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) @@ -370,9 +381,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%d %s create_files " + "-f 10 --base-file-name newfilename %s" % ( + sys.version_info.major, 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) @@ -386,8 +398,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%d %s read %s" % ( + sys.version_info.major, 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) @@ -411,9 +424,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%d %s create_files " + "-f 10 --base-file-name textfile %s" % ( + sys.version_info.major, 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) @@ -427,8 +441,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%d %s read %s" % ( + sys.version_info.major, 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) @@ -449,9 +464,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%d %s create_files " + "-f 10 --base-file-name newtextfile %s" % ( + sys.version_info.major, 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) @@ -465,8 +481,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%d %s read %s" % ( + sys.version_info.major, 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) @@ -635,9 +652,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%d %s create_files " + "-f 10 --base-file-name lastfile %s" % ( + sys.version_info.major, 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) @@ -651,8 +669,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%d %s read %s" % ( + sys.version_info.major, 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) diff --git a/tests/functional/afr/test_client_side_quorum_with_fixed_validate_max_bricks.py b/tests/functional/afr/test_client_side_quorum_with_fixed_validate_max_bricks.py index 67929cc86..64704b011 100755 --- a/tests/functional/afr/test_client_side_quorum_with_fixed_validate_max_bricks.py +++ b/tests/functional/afr/test_client_side_quorum_with_fixed_validate_max_bricks.py @@ -42,7 +42,7 @@ class ClientSideQuorumTests(GlusterBaseClass): """ # 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 " @@ -59,7 +59,7 @@ class ClientSideQuorumTests(GlusterBaseClass): """ # 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) @@ -92,7 +92,7 @@ class ClientSideQuorumTests(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_validate_max_bricks(self): """ diff --git a/tests/functional/afr/test_client_side_quorum_with_multiple_volumes.py b/tests/functional/afr/test_client_side_quorum_with_multiple_volumes.py index c31041703..ca65474f1 100644 --- a/tests/functional/afr/test_client_side_quorum_with_multiple_volumes.py +++ b/tests/functional/afr/test_client_side_quorum_with_multiple_volumes.py @@ -18,6 +18,7 @@ Test Cases in this module tests the client side quorum. """ +import sys import tempfile from glusto.core import Glusto as g @@ -44,7 +45,7 @@ class ClientSideQuorumTestsMultipleVols(GlusterBaseClass): @classmethod def setUpClass(cls): # 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", @@ -153,7 +154,7 @@ class ClientSideQuorumTestsMultipleVols(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() self.all_mounts_procs = [] self.io_validation_complete = False @@ -180,7 +181,7 @@ class ClientSideQuorumTestsMultipleVols(GlusterBaseClass): g.log.info("Listing all files and directories is successful") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() @classmethod def tearDownClass(cls): @@ -208,7 +209,7 @@ class ClientSideQuorumTestsMultipleVols(GlusterBaseClass): cls.client) # calling GlusterBaseClass tearDownClass - GlusterBaseClass.tearDownClass.im_func(cls) + cls.get_super_method(cls, 'tearDownClass')() def test_client_side_quorum_auto_local_to_volume_not_cluster(self): """ @@ -229,9 +230,10 @@ class ClientSideQuorumTestsMultipleVols(GlusterBaseClass): for mount_point in self.mount_points: self.all_mounts_procs = [] g.log.info('Creating files...') - command = ("python %s create_files -f 50 " - "--fixed-file-size 1k %s" - % (self.script_upload_path, mount_point)) + command = ("/usr/bin/env python%d %s create_files -f 50 " + "--fixed-file-size 1k %s" % ( + sys.version_info.major, self.script_upload_path, + mount_point)) proc = g.run_async(self.mounts[0].client_system, command) self.all_mounts_procs.append(proc) @@ -332,7 +334,7 @@ class ClientSideQuorumTestsMultipleVols(GlusterBaseClass): # merge two dicts (volname: file_to_delete) and (volname: mountpoint) temp_dict = [vols_file_list, self.mount_points_and_volnames] file_to_delete_to_mountpoint_dict = {} - for k in vols_file_list.iterkeys(): + for k in vols_file_list: file_to_delete_to_mountpoint_dict[k] = ( tuple(file_to_delete_to_mountpoint_dict[k] for file_to_delete_to_mountpoint_dict in diff --git a/tests/functional/afr/test_conservative_merge_of_files_heal_command.py b/tests/functional/afr/test_conservative_merge_of_files_heal_command.py index 06514b972..9a703c948 100644 --- a/tests/functional/afr/test_conservative_merge_of_files_heal_command.py +++ b/tests/functional/afr/test_conservative_merge_of_files_heal_command.py @@ -14,7 +14,10 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +import sys + from glusto.core import Glusto as g + from glustolibs.gluster.gluster_base_class import (GlusterBaseClass, runs_on) from glustolibs.gluster.exceptions import ExecutionError from glustolibs.gluster.volume_ops import set_volume_options @@ -45,7 +48,7 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): @classmethod def setUpClass(cls): # 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", @@ -71,7 +74,7 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() self.all_mounts_procs = [] self.io_validation_complete = False @@ -106,7 +109,7 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_conservative_merge_of_files_heal_command(self): """ @@ -160,9 +163,10 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): mount_obj.client_system, mount_obj.mountpoint) # Create files g.log.info('Creating files...') - command = ("python %s create_deep_dirs_with_files " - "-d 0 -l 5 -f 10 --dirname-start-num 1 %s" - % (self.script_upload_path, mount_obj.mountpoint)) + command = ("/usr/bin/env python%d %s create_deep_dirs_with_files " + "-d 0 -l 5 -f 10 --dirname-start-num 1 %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, command, user=mount_obj.user) @@ -204,9 +208,10 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): mount_obj.client_system, mount_obj.mountpoint) # Create files g.log.info('Creating files...') - command = ("python %s create_deep_dirs_with_files " - "-d 0 -l 5 -f 10 --dirname-start-num 6 %s" - % (self.script_upload_path, mount_obj.mountpoint)) + command = ("/usr/bin/env python%d %s create_deep_dirs_with_files " + "-d 0 -l 5 -f 10 --dirname-start-num 6 %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, command, user=mount_obj.user) @@ -320,6 +325,7 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): g.log.info('Arequals for mountpoint and %s are equal', brick) g.log.info('All arequals are equal for replicated') - self.assertNotEqual(cmp(arequals_before_heal, arequals_after_heal), 0, - 'Arequals are equal for bricks ' - 'before and after healing') + self.assertNotEqual( + arequals_before_heal, arequals_after_heal, + 'Arequals are equal for bricks before (%s) and after (%s) ' + 'healing' % (arequals_before_heal, arequals_after_heal)) diff --git a/tests/functional/afr/test_dist_to_repl_automatic_heal_should_be_triggered.py b/tests/functional/afr/test_dist_to_repl_automatic_heal_should_be_triggered.py index b49db5336..8ff1377cc 100755 --- a/tests/functional/afr/test_dist_to_repl_automatic_heal_should_be_triggered.py +++ b/tests/functional/afr/test_dist_to_repl_automatic_heal_should_be_triggered.py @@ -14,7 +14,10 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +import sys + from glusto.core import Glusto as g + from glustolibs.gluster.gluster_base_class import (GlusterBaseClass, runs_on) from glustolibs.gluster.exceptions import ExecutionError from glustolibs.gluster.brick_libs import (get_all_bricks, @@ -39,7 +42,7 @@ class TestSelfHeal(GlusterBaseClass): @classmethod def setUpClass(cls): # 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", @@ -64,7 +67,7 @@ class TestSelfHeal(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() self.all_mounts_procs = [] self.io_validation_complete = False @@ -95,7 +98,7 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_dist_to_repl_automatic_heal_should_be_triggered(self): """ @@ -117,12 +120,13 @@ class TestSelfHeal(GlusterBaseClass): for mount_obj in self.mounts: g.log.info("Starting IO on %s:%s", mount_obj.client_system, mount_obj.mountpoint) - cmd = ("python %s create_deep_dirs_with_files " + cmd = ("/usr/bin/env python%d %s create_deep_dirs_with_files " "--dir-length 1 " "--dir-depth 1 " "--max-num-of-dirs 1 " - "--num-of-files 10 %s" % (self.script_upload_path, - mount_obj.mountpoint)) + "--num-of-files 10 %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) self.all_mounts_procs.append(proc) @@ -230,8 +234,10 @@ class TestSelfHeal(GlusterBaseClass): for mount_obj in self.mounts: g.log.info("Starting IO on %s:%s", mount_obj.client_system, mount_obj.mountpoint) - cmd = ("python %s create_files -f 100 --fixed-file-size 1k %s" - % (self.script_upload_path, mount_obj.mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files -f 100 " + "--fixed-file-size 1k %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) self.all_mounts_procs.append(proc) diff --git a/tests/functional/afr/test_file_permission_and_mode.py b/tests/functional/afr/test_file_permission_and_mode.py index aabfeb01f..038847aa7 100755 --- a/tests/functional/afr/test_file_permission_and_mode.py +++ b/tests/functional/afr/test_file_permission_and_mode.py @@ -57,7 +57,7 @@ class FileModeAndPermissionsTest(GlusterBaseClass): g.log.info('User %s successfully deleted on %s', user, host) def setUp(self): - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Create user qa for mount_object in self.mounts: @@ -96,7 +96,7 @@ class FileModeAndPermissionsTest(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_file_permissions(self): """ diff --git a/tests/functional/afr/test_gfid_assignment_on_dist_rep_vol.py b/tests/functional/afr/test_gfid_assignment_on_dist_rep_vol.py index 751275272..a9f6e9ce4 100644 --- a/tests/functional/afr/test_gfid_assignment_on_dist_rep_vol.py +++ b/tests/functional/afr/test_gfid_assignment_on_dist_rep_vol.py @@ -22,8 +22,11 @@ volume when lookup comes on that directory from the mount point. """ +import sys import time + 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.misc.misc_libs import upload_scripts @@ -40,7 +43,7 @@ class AssignGfidsOnAllSubvols(GlusterBaseClass): def setUpClass(cls): # 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 " @@ -73,7 +76,7 @@ class AssignGfidsOnAllSubvols(GlusterBaseClass): raise ExecutionError("Failed to create volume") g.log.info("Successful in cleaning up Volume %s", cls.volname) - GlusterBaseClass.tearDownClass.im_func(cls) + cls.get_super_method(cls, 'tearDownClass')() def verify_gfid(self, dirname): dir_gfids = dict() @@ -113,8 +116,9 @@ class AssignGfidsOnAllSubvols(GlusterBaseClass): # Create a directory on the mount g.log.info("Creating a directory") - cmd = ("python %s create_deep_dir -d 0 -l 0 %s/dir1 " - % (self.script_upload_path, self.mounts[0].mountpoint)) + cmd = "/usr/bin/env python%d %s create_deep_dir -d 0 -l 0 %s/dir1 " % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint) ret, _, _ = g.run(self.clients[0], cmd) self.assertEqual(ret, 0, "Failed to create directory on mountpoint") g.log.info("Directory created successfully on mountpoint") diff --git a/tests/functional/afr/test_gfid_assignment_on_lookup.py b/tests/functional/afr/test_gfid_assignment_on_lookup.py index de9e47f21..940f1fdf9 100644 --- a/tests/functional/afr/test_gfid_assignment_on_lookup.py +++ b/tests/functional/afr/test_gfid_assignment_on_lookup.py @@ -41,7 +41,7 @@ class AssignGfidOnLookup(GlusterBaseClass): def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Override Volumes if cls.volume_type == "replicated": @@ -82,7 +82,7 @@ class AssignGfidOnLookup(GlusterBaseClass): raise ExecutionError("Failed to create volume") g.log.info("Successful in cleaning up Volume %s", cls.volname) - GlusterBaseClass.tearDownClass.im_func(cls) + cls.get_super_method(cls, 'tearDownClass')() def verify_gfid(self, dirname): dir_gfids = dict() diff --git a/tests/functional/afr/test_gfid_heal.py b/tests/functional/afr/test_gfid_heal.py index 589a420a0..85147452d 100644 --- a/tests/functional/afr/test_gfid_heal.py +++ b/tests/functional/afr/test_gfid_heal.py @@ -36,8 +36,7 @@ class HealGfidTest(GlusterBaseClass): """ @classmethod def setUpClass(cls): - - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Override Volumes if cls.volume_type == "replicated": @@ -48,7 +47,7 @@ class HealGfidTest(GlusterBaseClass): 'transport': 'tcp'} def setUp(self): - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() g.log.info("Starting to Setup Volume %s", self.volname) self.all_mounts_procs = [] @@ -85,7 +84,7 @@ class HealGfidTest(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def verify_gfid_and_link_count(self, dirname, filename): """ diff --git a/tests/functional/afr/test_gfid_split_brain_resolution.py b/tests/functional/afr/test_gfid_split_brain_resolution.py index a73ee407d..8d8317a01 100644 --- a/tests/functional/afr/test_gfid_split_brain_resolution.py +++ b/tests/functional/afr/test_gfid_split_brain_resolution.py @@ -47,7 +47,7 @@ class TestSelfHeal(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Override replica count to be 3 if cls.volume_type == "replicated": @@ -65,7 +65,7 @@ class TestSelfHeal(GlusterBaseClass): def setUp(self): # 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 and Mount Volume") @@ -92,7 +92,7 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def toggle_bricks_and_perform_io(self, file_list, brick_list): """ diff --git a/tests/functional/afr/test_glustershd_on_all_volume_types.py b/tests/functional/afr/test_glustershd_on_all_volume_types.py index a7139114a..c2d38d806 100755 --- a/tests/functional/afr/test_glustershd_on_all_volume_types.py +++ b/tests/functional/afr/test_glustershd_on_all_volume_types.py @@ -41,7 +41,7 @@ class SelfHealDaemonProcessTestsWithMultipleVolumes(GlusterBaseClass): which is used in tests """ # calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() cls.default_volume_type_config = { 'replicated': { @@ -118,7 +118,7 @@ class SelfHealDaemonProcessTestsWithMultipleVolumes(GlusterBaseClass): g.log.info("Successfully Cleanedup all Volumes") # calling GlusterBaseClass tearDownClass - GlusterBaseClass.tearDownClass.im_func(cls) + cls.get_super_method(cls, 'tearDownClass')() def test_glustershd_on_all_volume_types(self): """ @@ -219,7 +219,7 @@ class SelfHealDaemonProcessTestsWithMultipleVolumes(GlusterBaseClass): (volume_type_info_for_replicate_after_adding_bricks ['volume_type_info']['typeStr']) - self.assertEquals( + self.assertEqual( volume_type_for_replicate_after_adding_bricks, 'Distributed-Replicate', ("Replicate volume type is not converted to " diff --git a/tests/functional/afr/test_glustershd_on_newly_probed_server.py b/tests/functional/afr/test_glustershd_on_newly_probed_server.py index 1c7fde3f5..68fb19be2 100755 --- a/tests/functional/afr/test_glustershd_on_newly_probed_server.py +++ b/tests/functional/afr/test_glustershd_on_newly_probed_server.py @@ -40,7 +40,7 @@ class SelfHealDaemonProcessTests(GlusterBaseClass): """ def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() self.extra_servers = self.servers[-2:] self.servers = self.servers[:-2] @@ -94,7 +94,7 @@ class SelfHealDaemonProcessTests(GlusterBaseClass): g.log.info("Peer probe success for detached servers %s", self.servers) # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_glustershd_on_newly_probed_server(self): """ @@ -171,10 +171,10 @@ class SelfHealDaemonProcessTests(GlusterBaseClass): self.assertFalse(ret, ("Self Heal Daemon process is running even " "after stopping volume %s" % self.volname)) for node in pids: - self.assertEquals(pids[node][0], -1, ("Self Heal Daemon is still " - "running on node %s even " - "after stopping all " - "volumes" % node)) + self.assertEqual( + pids[node][0], -1, + "Self Heal Daemon is still running on node %s even " + "after stopping all volumes" % node) g.log.info("Expected : No self heal daemon process is running " "after stopping all volumes") diff --git a/tests/functional/afr/test_heal_command_unsuccessful_as_bricks_down.py b/tests/functional/afr/test_heal_command_unsuccessful_as_bricks_down.py index 2e4ddb9a1..6437292ba 100755 --- a/tests/functional/afr/test_heal_command_unsuccessful_as_bricks_down.py +++ b/tests/functional/afr/test_heal_command_unsuccessful_as_bricks_down.py @@ -36,7 +36,7 @@ class TestSelfHeal(GlusterBaseClass): @classmethod def setUpClass(cls): # 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", @@ -61,7 +61,7 @@ class TestSelfHeal(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() self.all_mounts_procs = [] self.io_validation_complete = False @@ -92,7 +92,7 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_heal_command_unsuccessful_as_bricks_down(self): """ diff --git a/tests/functional/afr/test_heal_fail_1x3.py b/tests/functional/afr/test_heal_fail_1x3.py index 596b145a5..4be1f336c 100644 --- a/tests/functional/afr/test_heal_fail_1x3.py +++ b/tests/functional/afr/test_heal_fail_1x3.py @@ -16,7 +16,10 @@ # pylint: disable=too-many-statements, too-many-locals +import sys + 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_ops import set_volume_options @@ -36,7 +39,7 @@ class TestSelfHeal(GlusterBaseClass): def setUpClass(cls): # 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 " @@ -77,7 +80,7 @@ class TestSelfHeal(GlusterBaseClass): raise ExecutionError("Failed to create volume") g.log.info("Successful in cleaning up Volume %s", cls.volname) - GlusterBaseClass.tearDownClass.im_func(cls) + cls.get_super_method(cls, 'tearDownClass')() def test_heal_gfid_1x3(self): @@ -101,9 +104,10 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("creating a file from mount point") all_mounts_procs = [] for mount_obj in self.mounts: - cmd = ("python %s create_files " - "-f 1 --base-file-name test_file --fixed-file-size 10k %s" - % (self.script_upload_path, mount_obj.mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files -f 1 " + "--base-file-name test_file --fixed-file-size 10k %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) all_mounts_procs.append(proc) @@ -133,9 +137,10 @@ class TestSelfHeal(GlusterBaseClass): "from mount point") all_mounts_procs = [] for mount_obj in self.mounts: - cmd = ("python %s create_files " - "-f 1 --base-file-name test_file --fixed-file-size 1M %s" - % (self.script_upload_path, mount_obj.mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files -f 1 " + "--base-file-name test_file --fixed-file-size 1M %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) all_mounts_procs.append(proc) diff --git a/tests/functional/afr/test_heal_info_should_have_fixed_fields.py b/tests/functional/afr/test_heal_info_should_have_fixed_fields.py index ec9c1d95f..3d5da5ac5 100644 --- a/tests/functional/afr/test_heal_info_should_have_fixed_fields.py +++ b/tests/functional/afr/test_heal_info_should_have_fixed_fields.py @@ -14,7 +14,10 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +import sys + from glusto.core import Glusto as g + from glustolibs.gluster.gluster_base_class import (GlusterBaseClass, runs_on) from glustolibs.gluster.exceptions import ExecutionError from glustolibs.gluster.brick_libs import (select_bricks_to_bring_offline, @@ -41,7 +44,7 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): @classmethod def setUpClass(cls): # 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", @@ -59,7 +62,7 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() self.all_mounts_procs = [] self.io_validation_complete = False @@ -94,7 +97,7 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_heal_info_should_have_fixed_fields(self): """ @@ -111,9 +114,10 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): mount_obj.client_system, mount_obj.mountpoint) # Create files g.log.info('Creating files...') - command = ("python %s create_deep_dirs_with_files " - "-d 2 -l 2 -f 50 %s" - % (self.script_upload_path, mount_obj.mountpoint)) + command = ("/usr/bin/env python%d %s create_deep_dirs_with_files " + "-d 2 -l 2 -f 50 %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, command, user=mount_obj.user) @@ -123,10 +127,10 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): # Select bricks to bring offline bricks_to_bring_offline_dict = (select_bricks_to_bring_offline( self.mnode, self.volname)) - bricks_to_bring_offline = filter(None, ( + bricks_to_bring_offline = list(filter(None, ( bricks_to_bring_offline_dict['hot_tier_bricks'] + bricks_to_bring_offline_dict['cold_tier_bricks'] + - bricks_to_bring_offline_dict['volume_bricks'])) + bricks_to_bring_offline_dict['volume_bricks']))) # Bring brick offline g.log.info('Bringing bricks %s offline...', bricks_to_bring_offline) diff --git a/tests/functional/afr/test_manual_heal_should_trigger_heal.py b/tests/functional/afr/test_manual_heal_should_trigger_heal.py index bae9464cd..d75355b72 100755 --- a/tests/functional/afr/test_manual_heal_should_trigger_heal.py +++ b/tests/functional/afr/test_manual_heal_should_trigger_heal.py @@ -14,7 +14,10 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +import sys + from glusto.core import Glusto as g + from glustolibs.gluster.gluster_base_class import (GlusterBaseClass, runs_on) from glustolibs.gluster.exceptions import ExecutionError from glustolibs.gluster.brick_libs import get_all_bricks @@ -37,7 +40,7 @@ class TestSelfHeal(GlusterBaseClass): @classmethod def setUpClass(cls): # 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", @@ -62,7 +65,7 @@ class TestSelfHeal(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() self.all_mounts_procs = [] self.io_validation_complete = False @@ -93,7 +96,7 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_manual_heal_should_trigger_heal(self): """ @@ -112,12 +115,13 @@ class TestSelfHeal(GlusterBaseClass): for mount_obj in self.mounts: g.log.info("Starting IO on %s:%s", mount_obj.client_system, mount_obj.mountpoint) - cmd = ("python %s create_deep_dirs_with_files " + cmd = ("/usr/bin/env python%d %s create_deep_dirs_with_files " "--dir-length 1 " "--dir-depth 1 " "--max-num-of-dirs 1 " - "--num-of-files 10 %s" % (self.script_upload_path, - mount_obj.mountpoint)) + "--num-of-files 10 %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) self.all_mounts_procs.append(proc) diff --git a/tests/functional/afr/test_multiple_clients_dd_on_same_file_default.py b/tests/functional/afr/test_multiple_clients_dd_on_same_file_default.py index 0d7d82d18..6c1bca3b2 100644 --- a/tests/functional/afr/test_multiple_clients_dd_on_same_file_default.py +++ b/tests/functional/afr/test_multiple_clients_dd_on_same_file_default.py @@ -14,7 +14,10 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +import sys + from glusto.core import Glusto as g + from glustolibs.gluster.gluster_base_class import (GlusterBaseClass, runs_on) from glustolibs.gluster.exceptions import ExecutionError from glustolibs.gluster.brick_libs import (bring_bricks_offline, @@ -40,7 +43,7 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): @classmethod def setUpClass(cls): # 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", @@ -66,7 +69,7 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() self.all_mounts_procs = [] self.io_validation_complete = False @@ -101,7 +104,7 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_multiple_clients_dd_on_same_file_default(self): """ @@ -145,8 +148,9 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): mount_obj.client_system, mount_obj.mountpoint) # Create files g.log.info('Reading files...') - command = ("python %s read %s" - % (self.script_upload_path, mount_obj.mountpoint)) + command = "/usr/bin/env python%d %s read %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint) proc = g.run_async(mount_obj.client_system, command, user=mount_obj.user) diff --git a/tests/functional/afr/test_quota_limit_entry_heal.py b/tests/functional/afr/test_quota_limit_entry_heal.py index 033d326f4..9ae7c2013 100644 --- a/tests/functional/afr/test_quota_limit_entry_heal.py +++ b/tests/functional/afr/test_quota_limit_entry_heal.py @@ -43,8 +43,7 @@ class QuotaEntrySelfHealTest(GlusterBaseClass): """ @classmethod def setUpClass(cls): - - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Override Volumes if cls.volume_type == "replicated": @@ -55,7 +54,7 @@ class QuotaEntrySelfHealTest(GlusterBaseClass): 'transport': 'tcp'} def setUp(self): - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() g.log.info("Starting to Setup Volume %s", self.volname) self.all_mounts_procs = [] @@ -92,7 +91,7 @@ class QuotaEntrySelfHealTest(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_entry_heal_with_quota(self): """ diff --git a/tests/functional/afr/test_readlink.py b/tests/functional/afr/test_readlink.py index 0f2b34b65..beb95b311 100644 --- a/tests/functional/afr/test_readlink.py +++ b/tests/functional/afr/test_readlink.py @@ -32,7 +32,7 @@ class AfrReadlinkTest(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Override replica count to be 3 if cls.volume_type == "replicated": @@ -53,7 +53,7 @@ class AfrReadlinkTest(GlusterBaseClass): def setUp(self): # 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 and Mount Volume") @@ -75,7 +75,7 @@ class AfrReadlinkTest(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_readlink(self): # create file diff --git a/tests/functional/afr/test_self_heal_when_dir_quota_exceeded.py b/tests/functional/afr/test_self_heal_when_dir_quota_exceeded.py index 4648c0f68..7aa1ba965 100644 --- a/tests/functional/afr/test_self_heal_when_dir_quota_exceeded.py +++ b/tests/functional/afr/test_self_heal_when_dir_quota_exceeded.py @@ -21,7 +21,10 @@ files in a directory when directory quota is exceeded. """ +import sys + 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.brick_libs import (get_all_bricks, @@ -47,7 +50,7 @@ class HealFilesWhenDirQuotaExceeded(GlusterBaseClass): def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Override Volumes if cls.volume_type == "replicated": @@ -88,7 +91,7 @@ class HealFilesWhenDirQuotaExceeded(GlusterBaseClass): raise ExecutionError("Failed to create volume") g.log.info("Successful in cleaning up Volume %s", cls.volname) - GlusterBaseClass.tearDownClass.im_func(cls) + cls.get_super_method(cls, 'tearDownClass')() def test_heal_when_dir_quota_exceeded_(self): # Create a directory to set the quota_limit_usage @@ -96,9 +99,9 @@ class HealFilesWhenDirQuotaExceeded(GlusterBaseClass): g.log.info("Creating a directory") self.all_mounts_procs = [] for mount_object in self.mounts: - cmd = ("python %s create_deep_dir -d 0 -l 0 %s%s " - % (self.script_upload_path, mount_object.mountpoint, - path)) + cmd = "/usr/bin/env python%d %s create_deep_dir -d 0 -l 0 %s%s" % ( + sys.version_info.major, self.script_upload_path, + mount_object.mountpoint, path) ret = g.run(mount_object.client_system, cmd) self.assertTrue(ret, "Failed to create directory on mountpoint") g.log.info("Directory created successfully on mountpoint") diff --git a/tests/functional/afr/test_self_heal_with_quota_object_limit.py b/tests/functional/afr/test_self_heal_with_quota_object_limit.py index ff308c3f6..f9dde71ba 100644 --- a/tests/functional/afr/test_self_heal_with_quota_object_limit.py +++ b/tests/functional/afr/test_self_heal_with_quota_object_limit.py @@ -21,7 +21,10 @@ files in a directory when quota-object-limit is set. """ +import sys + 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.brick_libs import (get_all_bricks, @@ -47,7 +50,7 @@ class HealFilesWhenQuotaObjectLimitExceeded(GlusterBaseClass): def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Override Volumes if cls.volume_type == "replicated": @@ -88,7 +91,7 @@ class HealFilesWhenQuotaObjectLimitExceeded(GlusterBaseClass): raise ExecutionError("Failed to create volume") g.log.info("Successful in cleaning up Volume %s", cls.volname) - GlusterBaseClass.tearDownClass.im_func(cls) + cls.get_super_method(cls, 'tearDownClass')() def test_heal_when_quota_object_limit_exceeded(self): # Create a directory to set the quota_limit_objects @@ -96,9 +99,9 @@ class HealFilesWhenQuotaObjectLimitExceeded(GlusterBaseClass): g.log.info("Creating a directory") self.all_mounts_procs = [] for mount_object in self.mounts: - cmd = ("python %s create_deep_dir -d 0 -l 0 %s%s " - % (self.script_upload_path, mount_object.mountpoint, - path)) + cmd = "/usr/bin/env python%d %s create_deep_dir -d 0 -l 0 %s%s" % ( + sys.version_info.major, self.script_upload_path, + mount_object.mountpoint, path) ret = g.run(mount_object.client_system, cmd) self.assertTrue(ret, "Failed to create directory on mountpoint") g.log.info("Directory created successfully on mountpoint") @@ -137,8 +140,10 @@ class HealFilesWhenQuotaObjectLimitExceeded(GlusterBaseClass): for mount_object in self.mounts: g.log.info("Creating Files on %s:%s", mount_object.client_system, path) - cmd = ("python %s create_files -f 3 --base-file-name file-0 %s%s" - % (self.script_upload_path, mount_object.mountpoint, path)) + cmd = ("/usr/bin/env python%d %s create_files -f 3 " + "--base-file-name file-0 %s%s" % ( + sys.version_info.major, self.script_upload_path, + mount_object.mountpoint, path)) ret, _, _ = g.run(mount_object.client_system, cmd) self.assertEqual(ret, 0, ("Failed to create files on %s", path)) g.log.info("Files created successfully on mountpoint") @@ -160,8 +165,10 @@ class HealFilesWhenQuotaObjectLimitExceeded(GlusterBaseClass): # Try creating 5 more files, which should fail as the quota limit # exceeds - cmd = ("python %s create_files -f 5 --base-file-name file-1 %s%s" - % (self.script_upload_path, mount_object.mountpoint, path)) + cmd = ("/usr/bin/env python%d %s create_files -f 5 --base-file-name " + "file-1 %s%s" % ( + sys.version_info.major, self.script_upload_path, + mount_object.mountpoint, path)) ret, _, _ = g.run(mount_object.client_system, cmd) self.assertNotEqual(ret, 0, ("Creating 5 files succeeded while it was" "not supposed to.")) diff --git a/tests/functional/afr/test_shd_should_not_crash_executed_heal_info.py b/tests/functional/afr/test_shd_should_not_crash_executed_heal_info.py index 189d70af9..b13b84263 100755 --- a/tests/functional/afr/test_shd_should_not_crash_executed_heal_info.py +++ b/tests/functional/afr/test_shd_should_not_crash_executed_heal_info.py @@ -14,7 +14,10 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +import sys + from glusto.core import Glusto as g + from glustolibs.gluster.gluster_base_class import (GlusterBaseClass, runs_on) from glustolibs.gluster.exceptions import ExecutionError from glustolibs.gluster.volume_ops import set_volume_options @@ -37,7 +40,7 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): @classmethod def setUpClass(cls): # 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", @@ -63,7 +66,7 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() self.all_mounts_procs = [] self.io_validation_complete = False @@ -98,7 +101,7 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_shd_should_not_crash_executed_heal_info(self): """ @@ -131,8 +134,10 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): mount_obj.client_system, mount_obj.mountpoint) # Create files g.log.info('Creating files...') - command = ("python %s create_files -f 10 --fixed-file-size 1M %s" - % (self.script_upload_path, mount_obj.mountpoint)) + command = ("/usr/bin/env python%d %s create_files -f 10 " + "--fixed-file-size 1M %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, command, user=mount_obj.user) @@ -167,12 +172,13 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): mount_obj.client_system, mount_obj.mountpoint) # Create files g.log.info('Creating files...') - command = ("python %s create_files " + command = ("/usr/bin/env python%d %s create_files " "-f %s " "--fixed-file-size 1k " "--base-file-name new_file " "%s" - % (self.script_upload_path, + % (sys.version_info.major, + self.script_upload_path, number_of_files_one_brick_off, mount_obj.mountpoint)) @@ -237,12 +243,13 @@ class VerifySelfHealTriggersHealCommand(GlusterBaseClass): mount_obj.client_system, mount_obj.mountpoint) # Create files g.log.info('Creating files...') - command = ("python %s create_files " + command = ("/usr/bin/env python%d %s create_files " "-f %s " "--fixed-file-size 1k " "--base-file-name new_new_file " "%s" - % (self.script_upload_path, + % (sys.version_info.major, + self.script_upload_path, number_of_files_two_brick_off, mount_obj.mountpoint)) diff --git a/tests/functional/afr/test_volume_set_options.py b/tests/functional/afr/test_volume_set_options.py index 86067ea7e..27d62ac2d 100755 --- a/tests/functional/afr/test_volume_set_options.py +++ b/tests/functional/afr/test_volume_set_options.py @@ -42,7 +42,7 @@ class VolumeSetDataSelfHealTests(GlusterBaseClass): """ # calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() self.all_mounts_procs = [] self.io_validation_complete = False @@ -84,7 +84,7 @@ class VolumeSetDataSelfHealTests(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_volume_set_option_data_self_heal(self): """ @@ -358,10 +358,10 @@ class VolumeSetDataSelfHealTests(GlusterBaseClass): # Compare dicts with file size g.log.info('Compare arequal size on brick before bringing offline and' ' after bringing online') - self.assertFalse(cmp(arequal_before_brick_offline, - arequal_after_brick_offline), - 'arequal size on brick before bringing offline and ' - 'after bringing online are not equal') + self.assertEqual( + arequal_before_brick_offline, arequal_after_brick_offline, + 'arequal size on brick before bringing offline and ' + 'after bringing online are not equal') g.log.info('arequal size on brick before bringing offline and ' 'after bringing online are equal') diff --git a/tests/functional/afr/test_write_io_mount_point_resumed_quorum_restored.py b/tests/functional/afr/test_write_io_mount_point_resumed_quorum_restored.py index 18125933a..7aac1ba70 100755 --- a/tests/functional/afr/test_write_io_mount_point_resumed_quorum_restored.py +++ b/tests/functional/afr/test_write_io_mount_point_resumed_quorum_restored.py @@ -14,9 +14,11 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - +import sys import time + 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 ( @@ -41,7 +43,7 @@ class ClientSideQuorumRestored(GlusterBaseClass): @classmethod def setUpClass(cls): # 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", @@ -59,7 +61,7 @@ class ClientSideQuorumRestored(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() self.all_mounts_procs = [] self.io_validation_complete = False @@ -101,7 +103,7 @@ class ClientSideQuorumRestored(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_write_io_mount_point_resumed_quorum_restored_x3(self): """ @@ -151,8 +153,9 @@ class ClientSideQuorumRestored(GlusterBaseClass): mount_obj.client_system, mount_obj.mountpoint) # Creating files - cmd = ("python %s create_files -f 30 %s" - % (self.script_upload_path, mount_obj.mountpoint)) + cmd = "/usr/bin/env python%d %s create_files -f 30 %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) -- cgit