From f2e420c0e015e9dc75fe8f86452000291ba704d8 Mon Sep 17 00:00:00 2001 From: Sri Vignesh Date: Wed, 29 Jan 2020 17:09:26 +0530 Subject: [testfix] Add steps to stabilize afr testcases Added steps to reset volume and resolved teardown class cleanup failures. Change-Id: I06b0ed8810c9b064fd2ee7c0bfd261928d8c07db --- .../afr/heal/test_data_split_brain_resolution.py | 22 ++++++++++++---------- .../heal/test_metadata_split_brain_resolution.py | 22 ++++++++++++---------- .../afr/heal/test_self_heal_daemon_process.py | 11 ++++++++--- tests/functional/afr/test_heal_fail_1x3.py | 14 +++++++------- .../afr/test_self_heal_when_dir_quota_exceeded.py | 20 +++++++++++--------- .../afr/test_self_heal_with_quota_object_limit.py | 22 ++++++++++++---------- 6 files changed, 62 insertions(+), 49 deletions(-) (limited to 'tests/functional') diff --git a/tests/functional/afr/heal/test_data_split_brain_resolution.py b/tests/functional/afr/heal/test_data_split_brain_resolution.py index c200e1395..73fd144c1 100644 --- a/tests/functional/afr/heal/test_data_split_brain_resolution.py +++ b/tests/functional/afr/heal/test_data_split_brain_resolution.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 @@ -74,17 +74,19 @@ class HealDataSplitBrain(GlusterBaseClass): raise ExecutionError("Failed to Setup_Volume and Mount_Volume") g.log.info("Successful in Setup Volume and Mount Volume") - @classmethod - def tearDownClass(cls): - - # Cleanup Volume - g.log.info("Starting to clean up Volume %s", cls.volname) - ret = cls.unmount_volume_and_cleanup_volume(cls.mounts) + def tearDown(self): + """ + Cleanup and umount volume + """ + # Cleanup and umount 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 verify_brick_arequals(self): g.log.info("Fetching bricks for the volume: %s", self.volname) diff --git a/tests/functional/afr/heal/test_metadata_split_brain_resolution.py b/tests/functional/afr/heal/test_metadata_split_brain_resolution.py index 3c20a1061..7782a4de8 100644 --- a/tests/functional/afr/heal/test_metadata_split_brain_resolution.py +++ b/tests/functional/afr/heal/test_metadata_split_brain_resolution.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 @@ -72,17 +72,19 @@ class HealMetadataSplitBrain(GlusterBaseClass): raise ExecutionError("Failed to Setup_Volume and Mount_Volume") g.log.info("Successful in Setup Volume and Mount Volume") - @classmethod - def tearDownClass(cls): - - # Cleanup Volume - g.log.info("Starting to clean up Volume %s", cls.volname) - ret = cls.unmount_volume_and_cleanup_volume(cls.mounts) + def tearDown(self): + """ + Cleanup and umount volume + """ + # Cleanup and umount 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 verify_brick_arequals(self): g.log.info("Fetching bricks for the volume: %s", self.volname) diff --git a/tests/functional/afr/heal/test_self_heal_daemon_process.py b/tests/functional/afr/heal/test_self_heal_daemon_process.py index 1f8f7f84d..cee8c2907 100755 --- a/tests/functional/afr/heal/test_self_heal_daemon_process.py +++ b/tests/functional/afr/heal/test_self_heal_daemon_process.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2017 Red Hat, Inc. +# Copyright (C) 2016-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 @@ -40,7 +40,8 @@ from glustolibs.gluster.heal_libs import (get_self_heal_daemon_pid, is_shd_daemonized, are_all_self_heal_daemons_are_online) from glustolibs.gluster.volume_ops import (volume_stop, volume_start) -from glustolibs.gluster.gluster_init import restart_glusterd +from glustolibs.gluster.gluster_init import ( + restart_glusterd, wait_for_glusterd_to_start) from glustolibs.io.utils import validate_io_procs from glustolibs.misc.misc_libs import upload_scripts @@ -104,7 +105,6 @@ class SelfHealDaemonProcessTests(GlusterBaseClass): """ Clean up the volume and umount volume from client """ - # stopping the volume g.log.info("Starting to Unmount Volume and Cleanup Volume") ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts) @@ -357,6 +357,10 @@ class SelfHealDaemonProcessTests(GlusterBaseClass): g.log.info("Successfully restarted glusterd on all nodes %s", nodes) + self.assertTrue( + wait_for_glusterd_to_start(self.servers), + "Failed to start glusterd on %s" % self.servers) + # check the self heal daemon process after restarting glusterd process g.log.info("Starting to get self-heal daemon process on" " nodes %s", nodes) @@ -549,6 +553,7 @@ class SelfHealDaemonProcessTests(GlusterBaseClass): bricks_to_bring_offline) # Creating files for all volumes + self.all_mounts_procs = [] for mount_obj in self.mounts: g.log.info("Starting IO on %s:%s", mount_obj.client_system, mount_obj.mountpoint) diff --git a/tests/functional/afr/test_heal_fail_1x3.py b/tests/functional/afr/test_heal_fail_1x3.py index f288bda5d..9227646f0 100644 --- a/tests/functional/afr/test_heal_fail_1x3.py +++ b/tests/functional/afr/test_heal_fail_1x3.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 @@ -68,17 +68,17 @@ class TestSelfHeal(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) + g.log.info("Starting to clean up Volume %s", self.volname) + ret = self.unmount_volume_and_cleanup_volume(self.mounts) if not ret: raise ExecutionError("Failed to create volume") - g.log.info("Successful in cleaning up Volume %s", cls.volname) + g.log.info("Successful in cleaning up Volume %s", self.volname) - cls.get_super_method(cls, 'tearDownClass')() + # Calling GlusterBaseClass teardown + self.get_super_method(self, 'tearDown')() def test_heal_gfid_1x3(self): 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 3897fad6e..ed7837c0d 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 @@ -79,17 +79,19 @@ class HealFilesWhenDirQuotaExceeded(GlusterBaseClass): raise ExecutionError("Failed to Setup_Volume and Mount_Volume") g.log.info("Successful in Setup Volume and Mount Volume") - @classmethod - def tearDownClass(cls): - - # Cleanup Volume - g.log.info("Starting to clean up Volume %s", cls.volname) - ret = cls.unmount_volume_and_cleanup_volume(cls.mounts) + def tearDown(self): + """ + Cleanup and umount volume + """ + # Cleanup and umount 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_heal_when_dir_quota_exceeded(self): # Create a directory to set the quota_limit_usage 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 f77f23b4d..39d49e675 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 @@ -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 @@ -79,17 +79,19 @@ class HealFilesWhenQuotaObjectLimitExceeded(GlusterBaseClass): raise ExecutionError("Failed to Setup_Volume and Mount_Volume") g.log.info("Successful in Setup Volume and Mount Volume") - @classmethod - def tearDownClass(cls): - - # Cleanup Volume - g.log.info("Starting to clean up Volume %s", cls.volname) - ret = cls.unmount_volume_and_cleanup_volume(cls.mounts) + def tearDown(self): + """ + Cleanup and umount volume + """ + # Cleanup and umount 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_heal_when_quota_object_limit_exceeded(self): # Create a directory to set the quota_limit_objects -- cgit