From 065f51e673b3ccc39b153423359bed2dd572935d Mon Sep 17 00:00:00 2001 From: Valerii Ponomarov Date: Mon, 16 Dec 2019 18:26:45 +0530 Subject: [py2to3] Add py3 support in 'tests/functional/dht' Change-Id: I44fe85519c8fd381064670e54dac8736107b0928 Signed-off-by: Valerii Ponomarov --- .../test_add_brick_while_remove_brick_is_in_progress.py | 15 ++++++++------- tests/functional/dht/test_dht_create_dir.py | 5 +++-- tests/functional/dht/test_dht_hash_value.py | 5 +++-- tests/functional/dht/test_dir_change_perm.py | 4 ++-- tests/functional/dht/test_dir_change_perm_recursive.py | 16 +++++++++------- .../dht/test_directory_custom_extended_attributes.py | 10 +++++----- tests/functional/dht/test_directory_healing.py | 4 ++-- tests/functional/dht/test_excerise_rebalance_command.py | 17 ++++++++++------- ...es_in_layout_by_removebrick_commit_then_fixlayout.py | 2 +- ..._holes_in_layout_by_removebrick_force_then_lookup.py | 2 +- tests/functional/dht/test_lookup_dir.py | 4 ++-- tests/functional/dht/test_mkdir_hashdown.py | 6 +++--- .../dht/test_negative_exercise_add_brick_command.py | 8 ++++---- .../functional/dht/test_rebalance_add_brick_command.py | 14 ++++++++------ .../test_rebalance_dir_file_from_multiple_clients.py | 15 ++++++++------- .../dht/test_rebalance_start_when_glusterd_down.py | 15 +++++++++------ .../test_rebalance_while_remove_brick_is_in_progress.py | 15 ++++++++------- .../functional/dht/test_rebalance_with_hidden_files.py | 15 ++++++++------- .../dht/test_remove_brick_while_rebalance_is_running.py | 15 ++++++++------- tests/functional/dht/test_rename_directory.py | 5 +++-- .../dht/test_restart_glusterd_after_rebalance.py | 15 +++++++++------ .../test_stop_glusterd_while_rebalance_in_progress.py | 15 +++++++++------ tests/functional/dht/test_verify_create_hash.py | 6 +++--- ...est_volume_start_stop_while_rebalance_in_progress.py | 15 ++++++++------- 24 files changed, 134 insertions(+), 109 deletions(-) (limited to 'tests') diff --git a/tests/functional/dht/test_add_brick_while_remove_brick_is_in_progress.py b/tests/functional/dht/test_add_brick_while_remove_brick_is_in_progress.py index 21297ced8..bff9fc2c2 100644 --- a/tests/functional/dht/test_add_brick_while_remove_brick_is_in_progress.py +++ b/tests/functional/dht/test_add_brick_while_remove_brick_is_in_progress.py @@ -14,6 +14,7 @@ # 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 @@ -41,7 +42,7 @@ class RemoveBrickValidation(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 " @@ -60,7 +61,7 @@ class RemoveBrickValidation(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") @@ -86,14 +87,14 @@ class RemoveBrickValidation(GlusterBaseClass): for index, mount_obj in enumerate(self.mounts, start=1): 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 " "--dirname-start-num %d " "--dir-depth 2 " "--dir-length 2 " "--max-num-of-dirs 2 " - "--num-of-files 10 %s" % (self.script_upload_path, - index + 10, - mount_obj.mountpoint)) + "--num-of-files 10 %s" % ( + sys.version_info.major, self.script_upload_path, + index + 10, mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) all_mounts_procs.append(proc) @@ -134,7 +135,7 @@ class RemoveBrickValidation(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_add_brick_while_remove_brick_is_in_progress(self): # DHT Layout and hash validation diff --git a/tests/functional/dht/test_dht_create_dir.py b/tests/functional/dht/test_dht_create_dir.py index 2da473229..4b3cbbde6 100644 --- a/tests/functional/dht/test_dht_create_dir.py +++ b/tests/functional/dht/test_dht_create_dir.py @@ -48,7 +48,8 @@ class TestDhtClass(GlusterBaseClass): def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() + # Setup Volume and Mount Volume g.log.info("Starting to Setup Volume and Mount Volume") ret = cls.setup_volume_and_mount_volume(cls.mounts) @@ -66,7 +67,7 @@ class TestDhtClass(GlusterBaseClass): raise ExecutionError("Failed to clean-up 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_create_directory(self): diff --git a/tests/functional/dht/test_dht_hash_value.py b/tests/functional/dht/test_dht_hash_value.py index c5f08dcfa..b7969b60b 100644 --- a/tests/functional/dht/test_dht_hash_value.py +++ b/tests/functional/dht/test_dht_hash_value.py @@ -38,7 +38,8 @@ from glustolibs.gluster.glusterfile import (file_exists, get_fattr, ['glusterfs']]) class TestDHTHashValue(GlusterBaseClass): def setUp(self): - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() + # Setup Volume ret = self.setup_volume_and_mount_volume(self.mounts) @@ -216,4 +217,4 @@ class TestDHTHashValue(GlusterBaseClass): if not ret: g.log.error("Failed to Setup and Mount Volume") raise ExecutionError('Failed to unmount and clean volumes') - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() diff --git a/tests/functional/dht/test_dir_change_perm.py b/tests/functional/dht/test_dir_change_perm.py index c07cfb16e..4ee2bcd06 100644 --- a/tests/functional/dht/test_dir_change_perm.py +++ b/tests/functional/dht/test_dir_change_perm.py @@ -36,7 +36,7 @@ class DirChangePerm(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") @@ -76,7 +76,7 @@ class DirChangePerm(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_dir_change_perm(self): # pylint: disable=too-many-statements diff --git a/tests/functional/dht/test_dir_change_perm_recursive.py b/tests/functional/dht/test_dir_change_perm_recursive.py index 0ae02a9b4..4060d0a8c 100644 --- a/tests/functional/dht/test_dir_change_perm_recursive.py +++ b/tests/functional/dht/test_dir_change_perm_recursive.py @@ -14,6 +14,8 @@ # 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.constants import \ @@ -41,7 +43,7 @@ class DirChangePermRecursive(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 " @@ -59,7 +61,7 @@ class DirChangePermRecursive(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") @@ -98,7 +100,7 @@ class DirChangePermRecursive(GlusterBaseClass): g.log.info("Successful in Unmount Volume and Cleanup Volume") # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDownClass.im_func(self) + self.get_super_method(self, 'tearDown')() def test_dir_change_perm_recursive(self): # pylint: disable=too-many-statements @@ -108,14 +110,14 @@ class DirChangePermRecursive(GlusterBaseClass): for index, mount_obj in enumerate(self.mounts, start=1): 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 " "--dirname-start-num %d " "--dir-depth 2 " "--dir-length 5 " "--max-num-of-dirs 5 " - "--num-of-files 5 %s" % (self.script_upload_path, - index + 10, - mount_obj.mountpoint)) + "--num-of-files 5 %s" % ( + sys.version_info.major, self.script_upload_path, + index + 10, 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/dht/test_directory_custom_extended_attributes.py b/tests/functional/dht/test_directory_custom_extended_attributes.py index 332398854..b391593b1 100644 --- a/tests/functional/dht/test_directory_custom_extended_attributes.py +++ b/tests/functional/dht/test_directory_custom_extended_attributes.py @@ -45,7 +45,7 @@ class TestDirectoryCustomExtendedAttributes(GlusterBaseClass): """ def setUp(self): - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volume ret = self.setup_volume_and_mount_volume(self.mounts) @@ -211,9 +211,9 @@ class TestDirectoryCustomExtendedAttributes(GlusterBaseClass): command = 'ln -s {src} {dst}'.format(dst=linked_folder_name, src=folder_name) ret, _, _ = g.run(mount_point.client_system, command) - self.assertEquals(0, ret, - 'Failed to create link %s to directory %s' % ( - linked_folder_name, folder_name)) + self.assertEqual(0, ret, + 'Failed to create link %s to directory %s' % ( + linked_folder_name, folder_name)) self.assertTrue(file_exists(mount_point.client_system, linked_folder_name), 'Link does not exists on %s:%s' % @@ -359,4 +359,4 @@ class TestDirectoryCustomExtendedAttributes(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')() diff --git a/tests/functional/dht/test_directory_healing.py b/tests/functional/dht/test_directory_healing.py index 7783fb9bf..dd1586711 100644 --- a/tests/functional/dht/test_directory_healing.py +++ b/tests/functional/dht/test_directory_healing.py @@ -44,7 +44,7 @@ class TestDirHeal(GlusterBaseClass): """ Setup and mount volume or raise ExecutionError """ - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volume ret = self.setup_volume_and_mount_volume(self.mounts) @@ -136,4 +136,4 @@ class TestDirHeal(GlusterBaseClass): g.log.info("Successful in Unmount Volume and Cleanup Volume") # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDownClass.im_func(cls) + cls.get_super_method(cls, 'tearDownClass')() diff --git a/tests/functional/dht/test_excerise_rebalance_command.py b/tests/functional/dht/test_excerise_rebalance_command.py index b582df518..493a4997a 100644 --- a/tests/functional/dht/test_excerise_rebalance_command.py +++ b/tests/functional/dht/test_excerise_rebalance_command.py @@ -14,8 +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 from time import sleep + from glusto.core import Glusto as g + from glustolibs.gluster.constants import \ TEST_LAYOUT_IS_COMPLETE as LAYOUT_IS_COMPLETE from glustolibs.gluster.constants import FILETYPE_DIRS @@ -51,7 +54,7 @@ class TestExerciseRebalanceCommand(GlusterBaseClass): def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Setup Volume and Mount Volume g.log.info("Starting to Setup Volume and Mount Volume") @@ -76,7 +79,7 @@ class TestExerciseRebalanceCommand(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Start IO on mounts g.log.info("Starting IO on all mounts...") @@ -84,14 +87,14 @@ class TestExerciseRebalanceCommand(GlusterBaseClass): for index, mount_obj in enumerate(self.mounts, start=1): 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 " "--dirname-start-num %d " "--dir-depth 2 " "--dir-length 2 " "--max-num-of-dirs 2 " - "--num-of-files 10 %s" % (self.script_upload_path, - index + 10, - mount_obj.mountpoint)) + "--num-of-files 10 %s" % ( + sys.version_info.major, self.script_upload_path, + index + 10, mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) self.all_mounts_procs.append(proc) @@ -373,4 +376,4 @@ class TestExerciseRebalanceCommand(GlusterBaseClass): g.log.info("Successful in Unmount Volume and Cleanup Volume") # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDownClass.im_func(cls) + cls.get_super_method(cls, 'tearDownClass')() diff --git a/tests/functional/dht/test_induce_holes_in_layout_by_removebrick_commit_then_fixlayout.py b/tests/functional/dht/test_induce_holes_in_layout_by_removebrick_commit_then_fixlayout.py index d5d0956e4..448514c6f 100644 --- a/tests/functional/dht/test_induce_holes_in_layout_by_removebrick_commit_then_fixlayout.py +++ b/tests/functional/dht/test_induce_holes_in_layout_by_removebrick_commit_then_fixlayout.py @@ -37,7 +37,7 @@ class RebalanceValidation(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() if self.volume_type == "distributed-replicated": self.volume_configs = [] diff --git a/tests/functional/dht/test_induce_holes_in_layout_by_removebrick_force_then_lookup.py b/tests/functional/dht/test_induce_holes_in_layout_by_removebrick_force_then_lookup.py index a42f01f9b..c4acb67c3 100644 --- a/tests/functional/dht/test_induce_holes_in_layout_by_removebrick_force_then_lookup.py +++ b/tests/functional/dht/test_induce_holes_in_layout_by_removebrick_force_then_lookup.py @@ -36,7 +36,7 @@ class RebalanceValidation(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") diff --git a/tests/functional/dht/test_lookup_dir.py b/tests/functional/dht/test_lookup_dir.py index 861b91aeb..40a2d12f2 100644 --- a/tests/functional/dht/test_lookup_dir.py +++ b/tests/functional/dht/test_lookup_dir.py @@ -59,7 +59,7 @@ class TestLookupDir(GlusterBaseClass): """ Setup and mount volume or raise ExecutionError """ - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volume ret = self.setup_volume_and_mount_volume(self.mounts) @@ -277,4 +277,4 @@ class TestLookupDir(GlusterBaseClass): g.log.info("Successful in Unmount Volume and Cleanup Volume") # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDownClass.im_func(cls) + cls.get_super_method(cls, 'tearDownClass')() diff --git a/tests/functional/dht/test_mkdir_hashdown.py b/tests/functional/dht/test_mkdir_hashdown.py index ceb6d444d..827dc32a9 100644 --- a/tests/functional/dht/test_mkdir_hashdown.py +++ b/tests/functional/dht/test_mkdir_hashdown.py @@ -43,7 +43,7 @@ class TestMkdirHashdown(GlusterBaseClass): """ Setup and mount volume or raise ExecutionError """ - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volume ret = self.setup_volume_and_mount_volume(self.mounts) @@ -151,5 +151,5 @@ class TestMkdirHashdown(GlusterBaseClass): raise ExecutionError("Failed to Unmount Volume and Cleanup Volume") g.log.info("Successful in Unmount Volume and Cleanup Volume") - # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDownClass.im_func(cls) + # Calling GlusterBaseClass tearDownClass + cls.get_super_method(cls, 'tearDownClass')() diff --git a/tests/functional/dht/test_negative_exercise_add_brick_command.py b/tests/functional/dht/test_negative_exercise_add_brick_command.py index aab671ff7..36364141c 100644 --- a/tests/functional/dht/test_negative_exercise_add_brick_command.py +++ b/tests/functional/dht/test_negative_exercise_add_brick_command.py @@ -37,12 +37,12 @@ class ExerciseAddbrickCommand(GlusterBaseClass): def setUpClass(cls): """Upload the necessary scripts to run tests""" # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() def setUp(self): """Setup Volume""" # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volume Volume g.log.info("Starting to Setup Volume") @@ -65,7 +65,7 @@ class ExerciseAddbrickCommand(GlusterBaseClass): g.log.info("Volume deleted successfully : %s", volume) # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_add_brick_without_volname(self): """Test add-brick command without volume""" @@ -158,7 +158,7 @@ class AddBrickAlreadyPartOfAnotherVolume(GlusterBaseClass): raise ExecutionError("Unable to delete volume %s" % volume) g.log.info("Volume deleted successfully : %s", volume) - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_add_brick_already_part_of_another_volume(self): """ Test adding bricks to the volume which are already part of another diff --git a/tests/functional/dht/test_rebalance_add_brick_command.py b/tests/functional/dht/test_rebalance_add_brick_command.py index 17c57843d..0ccc8031d 100644 --- a/tests/functional/dht/test_rebalance_add_brick_command.py +++ b/tests/functional/dht/test_rebalance_add_brick_command.py @@ -16,6 +16,8 @@ """Positive test - Exercise Add-brick command""" +import sys + from glusto.core import Glusto as g from glustolibs.gluster.brick_libs import get_all_bricks @@ -37,7 +39,7 @@ class ExerciseAddbrickCommand(GlusterBaseClass): def setUp(self): """Setup Volume""" # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volume Volume g.log.info("Starting to Setup Volume") @@ -134,14 +136,14 @@ class ExerciseAddbrickCommand(GlusterBaseClass): for index, mount_obj in enumerate(self.mounts, start=1): 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 " "--dirname-start-num %d " "--dir-depth 2 " "--dir-length 2 " "--max-num-of-dirs 2 " - "--num-of-files 10 %s" % (script_location, - index + 10, - mount_obj.mountpoint)) + "--num-of-files 10 %s" % ( + sys.version_info.major, script_location, index + 10, + mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) # Expand volume @@ -180,4 +182,4 @@ class ExerciseAddbrickCommand(GlusterBaseClass): g.log.info("Volume deleted successfully : %s", volume) # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() diff --git a/tests/functional/dht/test_rebalance_dir_file_from_multiple_clients.py b/tests/functional/dht/test_rebalance_dir_file_from_multiple_clients.py index bfd0683c1..537eafbfc 100644 --- a/tests/functional/dht/test_rebalance_dir_file_from_multiple_clients.py +++ b/tests/functional/dht/test_rebalance_dir_file_from_multiple_clients.py @@ -14,6 +14,7 @@ # 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 @@ -52,7 +53,7 @@ class RebalanceValidation(GlusterBaseClass): def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Setup Volume and Mount Volume g.log.info("Starting to Setup Volume and Mount Volume") @@ -82,7 +83,7 @@ class RebalanceValidation(GlusterBaseClass): - IO creates deep dirs and files. """ # 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") @@ -113,14 +114,14 @@ class RebalanceValidation(GlusterBaseClass): for index, mount_obj in enumerate(self.mounts, start=1): 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 " "--dirname-start-num %d " "--dir-depth 2 " "--dir-length 5 " "--max-num-of-dirs 5 " - "--num-of-files 5 %s" % (self.script_upload_path, - index + 10, - mount_obj.mountpoint)) + "--num-of-files 5 %s" % ( + sys.version_info.major, self.script_upload_path, + index + 10, mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) self.all_mounts_procs.append(proc) @@ -157,7 +158,7 @@ class RebalanceValidation(GlusterBaseClass): g.log.info("Unmount Volume and Cleanup Volume: Success") # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_expanding_volume_when_io_in_progress(self): # pylint: disable=too-many-statements diff --git a/tests/functional/dht/test_rebalance_start_when_glusterd_down.py b/tests/functional/dht/test_rebalance_start_when_glusterd_down.py index abe7eeac1..ea6ae2b6d 100644 --- a/tests/functional/dht/test_rebalance_start_when_glusterd_down.py +++ b/tests/functional/dht/test_rebalance_start_when_glusterd_down.py @@ -15,8 +15,11 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. from random import choice +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.rebalance_ops import ( @@ -40,7 +43,7 @@ class RebalanceValidation(GlusterBaseClass): def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Setup Volume and Mount Volume g.log.info("Starting to Setup Volume and Mount Volume") @@ -69,14 +72,14 @@ class RebalanceValidation(GlusterBaseClass): for index, mount_obj in enumerate(cls.mounts, start=1): 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 " "--dirname-start-num %d " "--dir-depth 1 " "--dir-length 1 " "--max-num-of-dirs 1 " - "--num-of-files 1 %s" % (cls.script_upload_path, - index + 10, - mount_obj.mountpoint)) + "--num-of-files 1 %s" % ( + sys.version_info.major, cls.script_upload_path, + index + 10, mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) cls.all_mounts_procs.append(proc) @@ -203,4 +206,4 @@ class RebalanceValidation(GlusterBaseClass): g.log.info("Successful in Unmount Volume and Cleanup Volume") # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDownClass.im_func(cls) + cls.get_super_method(cls, 'tearDownClass')() diff --git a/tests/functional/dht/test_rebalance_while_remove_brick_is_in_progress.py b/tests/functional/dht/test_rebalance_while_remove_brick_is_in_progress.py index 6bc2c671a..d1b5ddf56 100644 --- a/tests/functional/dht/test_rebalance_while_remove_brick_is_in_progress.py +++ b/tests/functional/dht/test_rebalance_while_remove_brick_is_in_progress.py @@ -14,6 +14,7 @@ # 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 @@ -41,7 +42,7 @@ class RemoveBrickValidation(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 " @@ -60,7 +61,7 @@ class RemoveBrickValidation(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,14 +76,14 @@ class RemoveBrickValidation(GlusterBaseClass): for index, mount_obj in enumerate(self.mounts, start=1): 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 " "--dirname-start-num %d " "--dir-depth 2 " "--dir-length 15 " "--max-num-of-dirs 5 " - "--num-of-files 5 %s" % (self.script_upload_path, - index + 10, - mount_obj.mountpoint)) + "--num-of-files 5 %s" % ( + sys.version_info.major, self.script_upload_path, + index + 10, mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) all_mounts_procs.append(proc) @@ -123,7 +124,7 @@ class RemoveBrickValidation(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_rebalance_while_remove_brick_in_progress(self): """ diff --git a/tests/functional/dht/test_rebalance_with_hidden_files.py b/tests/functional/dht/test_rebalance_with_hidden_files.py index d3357bcfb..47ccb0cce 100644 --- a/tests/functional/dht/test_rebalance_with_hidden_files.py +++ b/tests/functional/dht/test_rebalance_with_hidden_files.py @@ -14,6 +14,7 @@ # 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 @@ -45,7 +46,7 @@ class RebalanceValidation(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 " @@ -67,7 +68,7 @@ class RebalanceValidation(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") @@ -87,7 +88,7 @@ class RebalanceValidation(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_rebalance_with_hidden_files(self): # pylint: disable=too-many-statements @@ -97,10 +98,10 @@ class RebalanceValidation(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 " - "--base-file-name . " - "-f 99 %s" % (self.script_upload_path, - mount_obj.mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files " + "--base-file-name . -f 99 %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/dht/test_remove_brick_while_rebalance_is_running.py b/tests/functional/dht/test_remove_brick_while_rebalance_is_running.py index c345d9719..f726299d3 100644 --- a/tests/functional/dht/test_remove_brick_while_rebalance_is_running.py +++ b/tests/functional/dht/test_remove_brick_while_rebalance_is_running.py @@ -14,6 +14,7 @@ # 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 @@ -49,7 +50,7 @@ class RebalanceValidation(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 " @@ -68,7 +69,7 @@ class RebalanceValidation(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") @@ -95,14 +96,14 @@ class RebalanceValidation(GlusterBaseClass): for index, mount_obj in enumerate(self.mounts, start=1): 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 " "--dirname-start-num %d " "--dir-depth 2 " "--dir-length 5 " "--max-num-of-dirs 5 " - "--num-of-files 10 %s" % (self.script_upload_path, - index + 10, - mount_obj.mountpoint)) + "--num-of-files 10 %s" % ( + sys.version_info.major, self.script_upload_path, + index + 10, mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) self.all_mounts_procs.append(proc) @@ -143,7 +144,7 @@ class RebalanceValidation(GlusterBaseClass): g.log.info("Successful in Unmount Volume and Cleanup Volume") # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDownClass.im_func(self) + self.get_super_method(self, 'tearDown')() def test_remove_brick_while_rebalance_is_running(self): diff --git a/tests/functional/dht/test_rename_directory.py b/tests/functional/dht/test_rename_directory.py index cc383c074..ef2eae258 100644 --- a/tests/functional/dht/test_rename_directory.py +++ b/tests/functional/dht/test_rename_directory.py @@ -47,7 +47,7 @@ class TestDHTRenameDirectory(GlusterBaseClass): """ Setup and mount volume or raise ExecutionError """ - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volume ret = self.setup_volume_and_mount_volume(self.mounts) @@ -288,5 +288,6 @@ class TestDHTRenameDirectory(GlusterBaseClass): if not ret: raise ExecutionError("Failed to Unmount Volume and Cleanup Volume") g.log.info("Successful in Unmount Volume and Cleanup Volume") + # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDownClass.im_func(self) + self.get_super_method(self, 'tearDown')() diff --git a/tests/functional/dht/test_restart_glusterd_after_rebalance.py b/tests/functional/dht/test_restart_glusterd_after_rebalance.py index 17bfee165..df875295a 100644 --- a/tests/functional/dht/test_restart_glusterd_after_rebalance.py +++ b/tests/functional/dht/test_restart_glusterd_after_rebalance.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.exceptions import ExecutionError from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on from glustolibs.gluster.rebalance_ops import ( @@ -39,7 +42,7 @@ class RebalanceValidation(GlusterBaseClass): def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Setup Volume and Mount Volume g.log.info("Starting to Setup Volume and Mount Volume") @@ -68,14 +71,14 @@ class RebalanceValidation(GlusterBaseClass): for index, mount_obj in enumerate(cls.mounts, start=1): 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 " "--dirname-start-num %d " "--dir-depth 2 " "--dir-length 2 " "--max-num-of-dirs 1 " - "--num-of-files 2 %s" % (cls.script_upload_path, - index + 10, - mount_obj.mountpoint)) + "--num-of-files 2 %s" % ( + sys.version_info.major, cls.script_upload_path, + index + 10, mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) cls.all_mounts_procs.append(proc) @@ -174,4 +177,4 @@ class RebalanceValidation(GlusterBaseClass): g.log.info("Successful in Unmount Volume and Cleanup Volume") # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDownClass.im_func(cls) + cls.get_super_method(cls, 'tearDownClass')() diff --git a/tests/functional/dht/test_stop_glusterd_while_rebalance_in_progress.py b/tests/functional/dht/test_stop_glusterd_while_rebalance_in_progress.py index c9b60103a..fccc0a924 100644 --- a/tests/functional/dht/test_stop_glusterd_while_rebalance_in_progress.py +++ b/tests/functional/dht/test_stop_glusterd_while_rebalance_in_progress.py @@ -15,8 +15,11 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. import random +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.rebalance_ops import ( @@ -43,7 +46,7 @@ class RebalanceValidation(GlusterBaseClass): def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Setup Volume and Mount Volume g.log.info("Starting to Setup Volume and Mount Volume") @@ -72,14 +75,14 @@ class RebalanceValidation(GlusterBaseClass): for index, mount_obj in enumerate(cls.mounts, start=1): 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 " "--dirname-start-num %d " "--dir-depth 3 " "--dir-length 3 " "--max-num-of-dirs 3 " - "--num-of-files 10 %s" % (cls.script_upload_path, - index + 10, - mount_obj.mountpoint)) + "--num-of-files 10 %s" % ( + sys.version_info.major, cls.script_upload_path, + index + 10, mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) cls.all_mounts_procs.append(proc) @@ -215,4 +218,4 @@ class RebalanceValidation(GlusterBaseClass): g.log.info("Successful in Unmount Volume and Cleanup Volume") # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDownClass.im_func(cls) + cls.get_super_method(cls, 'tearDownClass')() diff --git a/tests/functional/dht/test_verify_create_hash.py b/tests/functional/dht/test_verify_create_hash.py index 23e935392..83f6a7777 100644 --- a/tests/functional/dht/test_verify_create_hash.py +++ b/tests/functional/dht/test_verify_create_hash.py @@ -42,7 +42,7 @@ class TestCreateFile(GlusterBaseClass): """ Setup and mount volume or raise ExecutionError """ - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volume ret = self.setup_volume_and_mount_volume(self.mounts) @@ -162,5 +162,5 @@ class TestCreateFile(GlusterBaseClass): raise ExecutionError("Failed to Unmount Volume and Cleanup Volume") g.log.info("Successful in Unmount Volume and Cleanup Volume") - # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDownClass.im_func(cls) + # Calling GlusterBaseClass tearDownClass + cls.get_super_method(cls, 'tearDownClass')() diff --git a/tests/functional/dht/test_volume_start_stop_while_rebalance_in_progress.py b/tests/functional/dht/test_volume_start_stop_while_rebalance_in_progress.py index 6559a1e7e..ffbda6145 100644 --- a/tests/functional/dht/test_volume_start_stop_while_rebalance_in_progress.py +++ b/tests/functional/dht/test_volume_start_stop_while_rebalance_in_progress.py @@ -14,6 +14,7 @@ # 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 @@ -49,7 +50,7 @@ class RebalanceValidation(GlusterBaseClass): def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Setup Volume and Mount Volume g.log.info("Starting to Setup Volume and Mount Volume") @@ -89,14 +90,14 @@ class RebalanceValidation(GlusterBaseClass): for index, mount_obj in enumerate(cls.mounts, start=1): 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 " "--dirname-start-num %d " "--dir-depth 1 " "--dir-length 2 " "--max-num-of-dirs 2 " - "--num-of-files 55 %s" % (cls.script_upload_path, - index + 10, - mount_obj.mountpoint)) + "--num-of-files 55 %s" % ( + sys.version_info.major, cls.script_upload_path, + index + 10, mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) cls.all_mounts_procs.append(proc) @@ -220,5 +221,5 @@ class RebalanceValidation(GlusterBaseClass): raise ExecutionError("Failed to Unmount Volume and Cleanup Volume") g.log.info("Volume %s unmount and cleanup: Success", cls.volname) - # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDownClass.im_func(cls) + # Calling GlusterBaseClass tearDownClass + cls.get_super_method(cls, 'tearDownClass')() -- cgit