diff options
| author | Sri Vignesh <sselvan@redhat.com> | 2020-05-12 12:58:26 +0530 | 
|---|---|---|
| committer | Bala Konda Reddy M <bala12352@gmail.com> | 2020-05-15 13:47:51 +0000 | 
| commit | 736e31c5d1dc1106fa0cced36ea5f43b691c7689 (patch) | |
| tree | 6aa5b2dafeae47231a9c15cddb5dc7e8f2bffbc1 /tests | |
| parent | 2d1b8392fe626684c86fae06b93cf8acd308d105 (diff) | |
[Testfix] Move test from teardown class to teardown
Move cases from teardown class to teardown in snapshot
Change-Id: I7b33fa2728665fad000a5ad881f6690d40913f22
Signed-off-by: Sri Vignesh <sselvan@redhat.com>
Diffstat (limited to 'tests')
5 files changed, 29 insertions, 66 deletions
diff --git a/tests/functional/snapshot/test_activate_deactivate.py b/tests/functional/snapshot/test_activate_deactivate.py index d75931307..e3b46bb9c 100644 --- a/tests/functional/snapshot/test_activate_deactivate.py +++ b/tests/functional/snapshot/test_activate_deactivate.py @@ -1,4 +1,4 @@ -#  Copyright (C) 2017-2018  Red Hat, Inc. <http://www.redhat.com> +#  Copyright (C) 2017-2020 Red Hat, Inc. <http://www.redhat.com>  #  #  This program is free software; you can redistribute it and/or modify  #  it under the terms of the GNU General Public License as published by @@ -58,23 +58,15 @@ class TestActivateDeactivate(GlusterBaseClass):          if ret != 0:              raise ExecutionError("Snapshot Delete Failed")          g.log.info("Successfully deleted all snapshots") -        # Calling GlusterBaseClass tearDown -        self.get_super_method(self, 'tearDown')() -    @classmethod -    def tearDownClass(cls): -        """ -        Clean up the volume & mount -        """ -        # stopping the volume and clean up the volume -        g.log.info("Starting to Cleanup Volume") -        ret = cls.cleanup_volume() +        # Cleanup-volume +        ret = self.cleanup_volume()          if not ret: -            raise ExecutionError("Failed to Cleanup Volume and mount") -        g.log.info("Successful in Cleanup Volume and mount") +            raise ExecutionError("Failed to Cleanup Volume") +        g.log.info("Successful in Cleanup Volume") -        # calling GlusterBaseClass tearDownClass -        cls.get_super_method(cls, 'tearDownClass')() +        # Calling GlusterBaseClass tearDown +        self.get_super_method(self, 'tearDown')()      def test_activate_deactivate(self):          # pylint: disable=too-many-branches, too-many-statements diff --git a/tests/functional/snapshot/test_activate_on_create.py b/tests/functional/snapshot/test_activate_on_create.py index 82d8401af..939641b9c 100644 --- a/tests/functional/snapshot/test_activate_on_create.py +++ b/tests/functional/snapshot/test_activate_on_create.py @@ -1,4 +1,4 @@ -#  Copyright (C) 2017-2018  Red Hat, Inc. <http://www.redhat.com> +#  Copyright (C) 2017-2020 Red Hat, Inc. <http://www.redhat.com>  #  #  This program is free software; you can redistribute it and/or modify  #  it under the terms of the GNU General Public License as published by @@ -67,23 +67,14 @@ class TestActivateOnCreate(GlusterBaseClass):          g.log.info("set_snap_config Success to disable "                     "activate-on-create") -        # Calling GlusterBaseClass tearDown -        self.get_super_method(self, 'tearDown')() - -    @classmethod -    def tearDownClass(cls): -        """ -        Clean up the volume & mount -        """ -        # stopping the volume and clean up the volume -        g.log.info("Starting to Cleanup Volume") -        ret = cls.cleanup_volume() +        # Cleanup-volume +        ret = self.cleanup_volume()          if not ret: -            raise ExecutionError("Failed to Cleanup Volume and mount") -        g.log.info("Successful in Cleanup Volume and mount") +            raise ExecutionError("Failed to Cleanup Volume") +        g.log.info("Successful in Cleanup Volume") -        # calling GlusterBaseClass tearDownClass -        cls.get_super_method(cls, 'tearDownClass')() +        # Calling GlusterBaseClass tearDown +        self.get_super_method(self, 'tearDown')()      def test_activate_on_create(self):          # pylint: disable=too-many-branches, too-many-statements diff --git a/tests/functional/snapshot/test_auto_delete.py b/tests/functional/snapshot/test_auto_delete.py index 41aa6dc64..d1e934c02 100644 --- a/tests/functional/snapshot/test_auto_delete.py +++ b/tests/functional/snapshot/test_auto_delete.py @@ -85,13 +85,8 @@ class TestSnapAutoDelete(GlusterBaseClass):                                   "auto-delete")
          g.log.info("Successfully set the snapshot config options to default")
 -    @classmethod
 -    def tearDownClass(cls):
 -        # calling GlusterBaseClass tearDownClass
 -        cls.get_super_method(cls, 'tearDownClass')()
 -
 -        # Clean up the volume
 -        ret = cls.cleanup_volume()
 +        # Cleanup-volume
 +        ret = self.cleanup_volume()
          if not ret:
              raise ExecutionError("Failed to Cleanup Volume")
          g.log.info("Successful in Cleanup Volume")
 diff --git a/tests/functional/snapshot/test_snapshot_restore.py b/tests/functional/snapshot/test_snapshot_restore.py index 1e84c800f..99a82e2b7 100644 --- a/tests/functional/snapshot/test_snapshot_restore.py +++ b/tests/functional/snapshot/test_snapshot_restore.py @@ -1,4 +1,4 @@ -#  Copyright (C) 2016-2020  Red Hat, Inc. <http://www.redhat.com> +#  Copyright (C) 2016-2020 Red Hat, Inc. <http://www.redhat.com>  #  #  This program is free software; you can redistribute it and/or modify  #  it under the terms of the GNU General Public License as published by @@ -95,20 +95,14 @@ class SnapRestore(GlusterBaseClass):          ret, _, _ = snap_delete_all(self.mnode)          if not ret:              raise ExecutionError("Snapshot delete failed.") -        self.get_super_method(self, 'tearDown')() -    @classmethod -    def tearDownClass(cls): -        """ -        Clean up the volume & mount -        """ -        g.log.info("Starting volume and  mount cleanup") -        ret = cls.unmount_volume_and_cleanup_volume(cls.mounts) +        # Unmount and cleanup-volume +        ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)          if not ret: -            raise ExecutionError("Failed to cleanup volume and mount") -        g.log.info("Cleanup successful for the volume and mount") +            raise ExecutionError("Failed to Unmount and Cleanup Volume") +        g.log.info("Successful in Unmount Volume and Cleanup Volume") -        cls.get_super_method(cls, 'tearDownClass')() +        self.get_super_method(self, 'tearDown')()      def test_validate_snaps_restore(self):          # pylint: disable=too-many-statements diff --git a/tests/functional/snapshot/test_validate_snaps_dir_over_uss.py b/tests/functional/snapshot/test_validate_snaps_dir_over_uss.py index 705abe31b..c1e42517f 100644 --- a/tests/functional/snapshot/test_validate_snaps_dir_over_uss.py +++ b/tests/functional/snapshot/test_validate_snaps_dir_over_uss.py @@ -1,4 +1,4 @@ -#  Copyright (C) 2017-2020  Red Hat, Inc. <http://www.redhat.com> +#  Copyright (C) 2017-2020 Red Hat, Inc. <http://www.redhat.com>  #  #  This program is free software; you can redistribute it and/or modify  #  it under the terms of the GNU General Public License as published by @@ -89,23 +89,14 @@ class TestValidateUss(GlusterBaseClass):          g.log.info("Successfully disabled uss for volume"                     "%s", self.volname) -        # Calling GlusterBaseClass tearDown -        self.get_super_method(self, 'tearDown')() - -    @classmethod -    def tearDownClass(cls): -        """ -        Clean up the volume & mount -        """ -        # stopping the volume and clean up the volume -        g.log.info("Starting to Cleanup Volume") -        ret = cls.unmount_volume_and_cleanup_volume(cls.mounts) +        # Unmount and cleanup-volume +        ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)          if not ret: -            raise ExecutionError("Failed to Cleanup Volume and mount") -        g.log.info("Successful in Cleanup Volume and mount") +            raise ExecutionError("Failed to Unmount and Cleanup Volume") +        g.log.info("Successful in Unmount Volume and Cleanup Volume") -        # calling GlusterBaseClass tearDownClass -        cls.get_super_method(cls, 'tearDownClass')() +        # Calling GlusterBaseClass tearDown +        self.get_super_method(self, 'tearDown')()      def test_validate_snaps_dir_over_uss(self):  | 
