diff options
author | kshithijiyer <kshithij.ki@gmail.com> | 2019-03-25 16:00:14 +0530 |
---|---|---|
committer | Akarsha Rai <akrai@redhat.com> | 2019-04-09 05:39:29 +0000 |
commit | 7c1189a4a240df79e11d4275ab66395c3cd076fc (patch) | |
tree | c553fa1cf93a7f9f1585bb0b6b03faffe78bcd52 /tests/functional | |
parent | ec891a0fdbeec5846fc1d1a42b476d257ae7a5f9 (diff) |
Adding code for cleanup of all bricks on each server
Change-Id: I405843e0093ddb7138ee0a8afbfd4cd2f91e6284
Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
Diffstat (limited to 'tests/functional')
-rw-r--r-- | tests/functional/glusterd/test_restart_glusterd_while_rebalancing.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/functional/glusterd/test_restart_glusterd_while_rebalancing.py b/tests/functional/glusterd/test_restart_glusterd_while_rebalancing.py index 22aee4e3e..c1288f9fe 100644 --- a/tests/functional/glusterd/test_restart_glusterd_while_rebalancing.py +++ b/tests/functional/glusterd/test_restart_glusterd_while_rebalancing.py @@ -30,6 +30,8 @@ from glustolibs.gluster.gluster_init import (restart_glusterd, is_glusterd_running) from glustolibs.io.utils import validate_io_procs from glustolibs.misc.misc_libs import upload_scripts +from glustolibs.gluster.glusterdir import get_dir_contents +from glustolibs.gluster.lib_utils import get_servers_bricks_dict @runs_on([['distributed', 'replicated', 'distributed-replicated', @@ -58,6 +60,20 @@ class TestRestartGlusterdWhileRebalance(GlusterBaseClass): """ setUp method for every test """ + + 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.") + # Creating Volume ret = self.setup_volume_and_mount_volume(self.mounts) if not ret: @@ -131,11 +147,11 @@ class TestRestartGlusterdWhileRebalance(GlusterBaseClass): ) # Forming brick list - brick_list = form_bricks_list_to_add_brick( + self.brick_list = form_bricks_list_to_add_brick( self.mnode, self.volname, self.servers, self.all_servers_info) # Adding Bricks - ret, _, _ = add_brick(self.mnode, self.volname, brick_list) + ret, _, _ = add_brick(self.mnode, self.volname, self.brick_list) self.assertEqual(ret, 0, "Failed to add brick to the volume %s" % self.volname) g.log.info("Brick added successfully to the volume %s", self.volname) |