From c6ecdf1b82cc6215c058aeaeeeacc70c0f6d82b0 Mon Sep 17 00:00:00 2001 From: Sri Vignesh Date: Mon, 11 May 2020 12:12:59 +0530 Subject: [TestFix][DHT] Moving test steps from teardown class to teardown Move cases from teardown class to teardown in dht Change-Id: Id0cf120c6229715521ae19fd4bb00cad553d701f Signed-off-by: Sri Vignesh --- tests/functional/dht/test_access_file.py | 24 +++++++++++----------- tests/functional/dht/test_dht_copy_dir.py | 16 +++++++-------- tests/functional/dht/test_dht_create_dir.py | 18 ++++++++-------- tests/functional/dht/test_directory_healing.py | 14 ++++++------- ...aling_of_custom_xattrs_on_newly_added_bricks.py | 14 ++++++------- ...s_in_layout_by_removebrick_force_then_lookup.py | 4 ++++ tests/functional/dht/test_lookup_dir.py | 16 +++++++-------- tests/functional/dht/test_mkdir_hashdown.py | 18 ++++++++-------- .../dht/test_rebalance_start_when_glusterd_down.py | 12 +++++------ .../dht/test_restart_glusterd_after_rebalance.py | 14 ++++++------- ...st_stop_glusterd_while_rebalance_in_progress.py | 12 +++++------ tests/functional/dht/test_verify_create_hash.py | 18 ++++++++-------- ...olume_start_stop_while_rebalance_in_progress.py | 16 +++++++-------- 13 files changed, 98 insertions(+), 98 deletions(-) (limited to 'tests') diff --git a/tests/functional/dht/test_access_file.py b/tests/functional/dht/test_access_file.py index ac8074a81..bb56e40b7 100644 --- a/tests/functional/dht/test_access_file.py +++ b/tests/functional/dht/test_access_file.py @@ -52,6 +52,18 @@ class TestFileAccessSubvolDown(GlusterBaseClass): g.log.error("Failed to Setup and Mount Volume") raise ExecutionError("Failed to Setup and Mount Volume") + def tearDown(self): + + # Unmount and cleanup original volume + g.log.info("Starting to Unmount Volume and Cleanup Volume") + ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts) + if not ret: + raise ExecutionError("Failed to umount the vol & cleanup Volume") + g.log.info("Successful in umounting the volume and Cleanup") + + # Calling GlusterBaseClass tearDown + self.get_super_method(self, 'tearDown')() + def test_file_access(self): """ Test file access. @@ -158,15 +170,3 @@ class TestFileAccessSubvolDown(GlusterBaseClass): ret, _, _ = g.run(self.clients[0], ("stat %s" % dstfile)) self.assertEqual(ret, 1, ('stat error on for file %s', dstfile)) g.log.info("dstfile access failed as expected") - - @classmethod - def tearDownClass(cls): - # Unmount Volume and Cleanup Volume - g.log.info("Starting to Unmount Volume and Cleanup Volume") - ret = cls.unmount_volume_and_cleanup_volume(mounts=cls.mounts) - 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 - cls.get_super_method(cls, 'tearDownClass')() diff --git a/tests/functional/dht/test_dht_copy_dir.py b/tests/functional/dht/test_dht_copy_dir.py index 60ff4406a..a2308b5c2 100644 --- a/tests/functional/dht/test_dht_copy_dir.py +++ b/tests/functional/dht/test_dht_copy_dir.py @@ -202,17 +202,17 @@ class DhtCopyTest(GlusterBaseClass): raise ExecutionError("Failed to Setup_Volume and Mount_Volume") g.log.info("Successful in Setup Volume and Mount Volume") - @classmethod - def tearDownClass(cls): + def tearDown(self): - # Cleanup Volume - g.log.info("Starting to clean up Volume %s", cls.volname) - ret = cls.unmount_volume_and_cleanup_volume(cls.mounts) + # Unmount and cleanup original volume + g.log.info("Starting to Unmount Volume and Cleanup Volume") + ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts) if not ret: - raise ExecutionError("Failed to create volume") - g.log.info("Successful in cleaning up Volume %s", cls.volname) + raise ExecutionError("Failed to umount the vol & cleanup Volume") + g.log.info("Successful in umounting the volume and Cleanup") - cls.get_super_method(cls, 'tearDownClass')() + # Calling GlusterBaseClass tearDown + self.get_super_method(self, 'tearDown')() def test_copy_directory(self): diff --git a/tests/functional/dht/test_dht_create_dir.py b/tests/functional/dht/test_dht_create_dir.py index 4b3cbbde6..f39e0d473 100644 --- a/tests/functional/dht/test_dht_create_dir.py +++ b/tests/functional/dht/test_dht_create_dir.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2019 Red Hat, Inc. +# Copyright (C) 2017-2020 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -57,17 +57,17 @@ class TestDhtClass(GlusterBaseClass): raise ExecutionError("Failed to Setup_Volume and Mount_Volume") g.log.info("Successful in Setup Volume and Mount Volume") - @classmethod - def tearDownClass(cls): + def tearDown(self): - # Cleanup Volume - g.log.info("Starting to clean up Volume %s", cls.volname) - ret = cls.unmount_volume_and_cleanup_volume(cls.mounts) + # Unmount and cleanup original volume + g.log.info("Starting to Unmount Volume and Cleanup Volume") + ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts) if not ret: - raise ExecutionError("Failed to clean-up volume") - g.log.info("Successful in cleaning up Volume %s", cls.volname) + raise ExecutionError("Failed to umount the vol & cleanup Volume") + g.log.info("Successful in umounting the volume and Cleanup") - cls.get_super_method(cls, 'tearDownClass')() + # Calling GlusterBaseClass tearDown + self.get_super_method(self, 'tearDown')() def test_create_directory(self): diff --git a/tests/functional/dht/test_directory_healing.py b/tests/functional/dht/test_directory_healing.py index 50a12886a..e01a0240f 100644 --- a/tests/functional/dht/test_directory_healing.py +++ b/tests/functional/dht/test_directory_healing.py @@ -140,14 +140,14 @@ class TestDirHeal(GlusterBaseClass): else: g.log.error("Directory is not healed") - @classmethod - def tearDownClass(cls): - # Unmount Volume and Cleanup Volume + def tearDown(self): + + # Unmount and cleanup original volume g.log.info("Starting to Unmount Volume and Cleanup Volume") - ret = cls.unmount_volume_and_cleanup_volume(mounts=cls.mounts) + ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts) if not ret: - raise ExecutionError("Failed to Unmount Volume and Cleanup Volume") - g.log.info("Successful in Unmount Volume and Cleanup Volume") + raise ExecutionError("Failed to umount the vol & cleanup Volume") + g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass tearDown - cls.get_super_method(cls, 'tearDownClass')() + self.get_super_method(self, 'tearDown')() diff --git a/tests/functional/dht/test_healing_of_custom_xattrs_on_newly_added_bricks.py b/tests/functional/dht/test_healing_of_custom_xattrs_on_newly_added_bricks.py index 4f7f77ec0..d396702a0 100644 --- a/tests/functional/dht/test_healing_of_custom_xattrs_on_newly_added_bricks.py +++ b/tests/functional/dht/test_healing_of_custom_xattrs_on_newly_added_bricks.py @@ -50,17 +50,17 @@ class TestCustomxattrsOnNewBricks(GlusterBaseClass): raise ExecutionError("Failed to Setup_Volume and Mount_Volume") g.log.info("Successful in Setup Volume and Mount Volume") - @classmethod - def tearDownClass(cls): - # Unmount Volume and Cleanup Volume + def tearDown(self): + + # Unmount and cleanup original volume g.log.info("Starting to Unmount Volume and Cleanup Volume") - ret = cls.unmount_volume_and_cleanup_volume(mounts=cls.mounts) + ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts) if not ret: - raise ExecutionError("Failed to Unmount Volume and Cleanup Volume") - g.log.info("Successful in Unmount Volume and Cleanup Volume") + raise ExecutionError("Failed to umount the vol & cleanup Volume") + g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass tearDown - cls.get_super_method(cls, 'tearDownClass')() + self.get_super_method(self, 'tearDown')() def check_xattr(self, list_of_all_dirs): """ 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 51465ea81..04b72725a 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 @@ -163,9 +163,13 @@ class RebalanceValidation(GlusterBaseClass): if ret: raise ExecutionError("Failed to delete removed brick dir " "%s:%s" % (brick_node, brick_path)) + # Unmount Volume and Cleanup Volume g.log.info("Starting to Unmount Volume and Cleanup Volume") ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts) 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 + self.get_super_method(self, 'tearDown')() diff --git a/tests/functional/dht/test_lookup_dir.py b/tests/functional/dht/test_lookup_dir.py index 40a2d12f2..1e78ab7c0 100644 --- a/tests/functional/dht/test_lookup_dir.py +++ b/tests/functional/dht/test_lookup_dir.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2019 Red Hat, Inc. +# Copyright (C) 2018-2020 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -267,14 +267,14 @@ class TestLookupDir(GlusterBaseClass): ret = self.mkdir_nonhashed_down(subvols, parent_dir) self.assertTrue(ret, 'mkdir_nonhashed_down failed') - @classmethod - def tearDownClass(cls): - # Unmount Volume and Cleanup Volume + def tearDown(self): + + # Unmount and cleanup original volume g.log.info("Starting to Unmount Volume and Cleanup Volume") - ret = cls.unmount_volume_and_cleanup_volume(mounts=cls.mounts) + ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts) if not ret: - raise ExecutionError("Failed to Unmount Volume and Cleanup Volume") - g.log.info("Successful in Unmount Volume and Cleanup Volume") + raise ExecutionError("Failed to umount the vol & cleanup Volume") + g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass tearDown - cls.get_super_method(cls, 'tearDownClass')() + self.get_super_method(self, 'tearDown')() diff --git a/tests/functional/dht/test_mkdir_hashdown.py b/tests/functional/dht/test_mkdir_hashdown.py index 827dc32a9..c64751ec3 100644 --- a/tests/functional/dht/test_mkdir_hashdown.py +++ b/tests/functional/dht/test_mkdir_hashdown.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2019 Red Hat, Inc. +# Copyright (C) 2018-2020 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -142,14 +142,14 @@ class TestMkdirHashdown(GlusterBaseClass): g.log.info('dir %s does not exist on mount as expected', child_dir) - @classmethod - def tearDownClass(cls): - # Unmount Volume and Cleanup Volume + def tearDown(self): + + # Unmount and cleanup original volume g.log.info("Starting to Unmount Volume and Cleanup Volume") - ret = cls.unmount_volume_and_cleanup_volume(mounts=cls.mounts) + ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts) if not ret: - raise ExecutionError("Failed to Unmount Volume and Cleanup Volume") - g.log.info("Successful in Unmount Volume and Cleanup Volume") + raise ExecutionError("Failed to umount the vol & cleanup Volume") + g.log.info("Successful in umounting the volume and Cleanup") - # Calling GlusterBaseClass tearDownClass - cls.get_super_method(cls, 'tearDownClass')() + # Calling GlusterBaseClass tearDown + self.get_super_method(self, 'tearDown')() 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 885deb2b0..bca96d2cd 100644 --- a/tests/functional/dht/test_rebalance_start_when_glusterd_down.py +++ b/tests/functional/dht/test_rebalance_start_when_glusterd_down.py @@ -193,14 +193,12 @@ class RebalanceValidation(GlusterBaseClass): "Failed") g.log.info("All peers are in connected state") - @classmethod - def tearDownClass(cls): - # Unmount Volume and Cleanup Volume + # Unmount and cleanup original volume g.log.info("Starting to Unmount Volume and Cleanup Volume") - ret = cls.unmount_volume_and_cleanup_volume(mounts=cls.mounts) + ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts) if not ret: - raise ExecutionError("Failed to Unmount Volume and Cleanup Volume") - g.log.info("Successful in Unmount Volume and Cleanup Volume") + raise ExecutionError("Failed to umount the vol & cleanup Volume") + g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass tearDown - cls.get_super_method(cls, 'tearDownClass')() + 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 5c278318d..b4436968d 100644 --- a/tests/functional/dht/test_restart_glusterd_after_rebalance.py +++ b/tests/functional/dht/test_restart_glusterd_after_rebalance.py @@ -163,14 +163,14 @@ class RebalanceValidation(GlusterBaseClass): g.log.info("Rebalance is NOT triggered on %s after glusterd " "restart", server) - @classmethod - def tearDownClass(cls): - # Unmount Volume and Cleanup Volume + def tearDown(self): + + # Unmount and cleanup original volume g.log.info("Starting to Unmount Volume and Cleanup Volume") - ret = cls.unmount_volume_and_cleanup_volume(mounts=cls.mounts) + ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts) if not ret: - raise ExecutionError("Failed to Unmount Volume and Cleanup Volume") - g.log.info("Successful in Unmount Volume and Cleanup Volume") + raise ExecutionError("Failed to umount the vol & cleanup Volume") + g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass tearDown - cls.get_super_method(cls, 'tearDownClass')() + self.get_super_method(self, 'tearDown')() 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 ba689f3c6..83a0ee991 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 @@ -205,14 +205,12 @@ class RebalanceValidation(GlusterBaseClass): if not ret: raise ExecutionError("All peers are in connected state") - @classmethod - def tearDownClass(cls): - # Unmount Volume and Cleanup Volume + # Unmount and cleanup original volume g.log.info("Starting to Unmount Volume and Cleanup Volume") - ret = cls.unmount_volume_and_cleanup_volume(mounts=cls.mounts) + ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts) if not ret: - raise ExecutionError("Failed to Unmount Volume and Cleanup Volume") - g.log.info("Successful in Unmount Volume and Cleanup Volume") + raise ExecutionError("Failed to umount the vol & cleanup Volume") + g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass tearDown - cls.get_super_method(cls, 'tearDownClass')() + self.get_super_method(self, 'tearDown')() diff --git a/tests/functional/dht/test_verify_create_hash.py b/tests/functional/dht/test_verify_create_hash.py index 83f6a7777..2f9fffd7b 100644 --- a/tests/functional/dht/test_verify_create_hash.py +++ b/tests/functional/dht/test_verify_create_hash.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2018 Red Hat, Inc. +# Copyright (C) 2017-2020 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -153,14 +153,14 @@ class TestCreateFile(GlusterBaseClass): ret, _, _ = g.run(self.clients[0], ("touch %s" % file_one)) self.assertTrue(ret, "Expected file creation to fail") - @classmethod - def tearDownClass(cls): - # Unmount Volume and Cleanup Volume + def tearDown(self): + + # Unmount and cleanup original volume g.log.info("Starting to Unmount Volume and Cleanup Volume") - ret = cls.unmount_volume_and_cleanup_volume(mounts=cls.mounts) + ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts) if not ret: - raise ExecutionError("Failed to Unmount Volume and Cleanup Volume") - g.log.info("Successful in Unmount Volume and Cleanup Volume") + raise ExecutionError("Failed to umount the vol & cleanup Volume") + g.log.info("Successful in umounting the volume and Cleanup") - # Calling GlusterBaseClass tearDownClass - cls.get_super_method(cls, 'tearDownClass')() + # Calling GlusterBaseClass tearDown + self.get_super_method(self, 'tearDown')() 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 d7dc35689..0bec68b8f 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 @@ -208,14 +208,14 @@ class RebalanceValidation(GlusterBaseClass): self.volname)) g.log.info("Volume %s state is \"Started\"", self.volname) - @classmethod - def tearDownClass(cls): - # Unmount Volume and Cleanup Volume + def tearDown(self): + + # Unmount and cleanup original volume g.log.info("Starting to Unmount Volume and Cleanup Volume") - ret = cls.unmount_volume_and_cleanup_volume(mounts=cls.mounts) + ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts) if not ret: - raise ExecutionError("Failed to Unmount Volume and Cleanup Volume") - g.log.info("Volume %s unmount and cleanup: Success", cls.volname) + raise ExecutionError("Failed to umount the vol & cleanup Volume") + g.log.info("Successful in umounting the volume and Cleanup") - # Calling GlusterBaseClass tearDownClass - cls.get_super_method(cls, 'tearDownClass')() + # Calling GlusterBaseClass tearDown + self.get_super_method(self, 'tearDown')() -- cgit