diff options
Diffstat (limited to 'tests/functional/glusterd/test_rebalance_spurious.py')
-rw-r--r-- | tests/functional/glusterd/test_rebalance_spurious.py | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/tests/functional/glusterd/test_rebalance_spurious.py b/tests/functional/glusterd/test_rebalance_spurious.py index c9dbed035..fa9f22084 100644 --- a/tests/functional/glusterd/test_rebalance_spurious.py +++ b/tests/functional/glusterd/test_rebalance_spurious.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018 Red Hat, Inc. <http://www.redhat.com> +# Copyright (C) 2018-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 @@ -25,12 +25,13 @@ from glustolibs.gluster.peer_ops import (peer_probe, peer_detach, peer_probe_servers, nodes_from_pool_list, is_peer_connected) -from glustolibs.gluster.lib_utils import form_bricks_list +from glustolibs.gluster.lib_utils import ( + form_bricks_list, get_servers_bricks_dict) from glustolibs.gluster.brick_ops import remove_brick from glustolibs.gluster.exceptions import ExecutionError from glustolibs.gluster.rebalance_ops import (rebalance_start, wait_for_fix_layout_to_complete) -from glustolibs.gluster.glusterdir import mkdir +from glustolibs.gluster.glusterdir import mkdir, get_dir_contents from glustolibs.gluster.mount_ops import mount_volume, umount_volume from glustolibs.gluster.glusterfile import get_fattr @@ -46,7 +47,7 @@ class TestSpuriousRebalance(GlusterBaseClass): if ret != 0: raise ExecutionError("Peer detach failed") g.log.info("Peer detach SUCCESSFUL.") - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() def tearDown(self): @@ -76,7 +77,21 @@ class TestSpuriousRebalance(GlusterBaseClass): "servers %s" % self.servers) g.log.info("Peer probe success for detached " "servers %s", self.servers) - GlusterBaseClass.tearDown.im_func(self) + + bricks = get_servers_bricks_dict(self.servers, + self.all_servers_info) + + # Checking brick dir and cleaning it. + for server in self.servers: + for brick in bricks[server]: + if get_dir_contents(server, brick): + cmd = "rm -rf " + brick + "/*" + ret, _, _ = g.run(server, cmd) + if ret: + raise ExecutionError("Failed to delete the brick " + "dirs of deleted volume.") + + self.get_super_method(self, 'tearDown')() def test_spurious_rebalance(self): """ |