summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkshithijiyer <kshithij.ki@gmail.com>2019-07-23 13:11:58 +0530
committerBala Konda Reddy M <bmekala@redhat.com>2019-08-06 11:58:03 +0000
commit81b0e86816fe4f34cbb26dc541071dbeda7666a9 (patch)
tree21a7a7a18a1d0b629ef11dabe003018495f8f304
parentfdda7fd56bd397979109bd31cf9c1ca2390e9524 (diff)
Adding test case to mount volume, remove /var/log/glusterfs/ and remount the volume.
Test case: 1. Create all types of volumes and start them. 2. Mount all volumes on clients. 3. Delete /var/log/glusterfs folder on client. 4. Run IO on all the mount points. 5. Unmount and remount all volumes. 6. Check if logs are regenerated or not. Change-Id: I4f90d709c4da6e1c73cf95f4075c50aa44cdd811 Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
-rw-r--r--tests/functional/glusterd/test_mount_after_removing_client_logs_dir.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/functional/glusterd/test_mount_after_removing_client_logs_dir.py b/tests/functional/glusterd/test_mount_after_removing_client_logs_dir.py
index 24871de..491e9ab 100644
--- a/tests/functional/glusterd/test_mount_after_removing_client_logs_dir.py
+++ b/tests/functional/glusterd/test_mount_after_removing_client_logs_dir.py
@@ -123,3 +123,63 @@ class TestRemoveCientLogDirAndMount(GlusterBaseClass):
'/var/log/glusterfs/')
self.assertIsNotNone(ret, 'Log files were not regenerated.')
g.log.info("Log files were properly regenearted.")
+
+ def test_mount_remove_client_logs_dir_remount(self):
+
+ # pylint: disable=too-many-statements
+ """
+ 1. Create all types of volumes and start them.
+ 2. Mount all volumes on clients.
+ 3. Delete /var/log/glusterfs folder on client.
+ 4. Run IO on all the mount points.
+ 5. Unmount and remount all volumes.
+ 6. Check if logs are regenerated or not.
+ """
+
+ # Mounting the volume.
+ ret, _, _ = mount_volume(self.volname, mtype=self.mount_type,
+ mpoint=self.mounts[0].mountpoint,
+ mserver=self.mnode,
+ mclient=self.mounts[0].client_system)
+ self.assertEqual(ret, 0, ("Volume %s is not mounted.") % self.volname)
+ g.log.info("Volume mounted successfully : %s", self.volname)
+
+ # Removing dir /var/log/glusterfs on client.
+ cmd = 'mv /var/log/glusterfs /root/'
+ ret, _, _ = g.run(self.mounts[0].client_system, cmd)
+ self.assertEqual(ret, 0, "Unable to remove /var/log/glusterfs dir.")
+ g.log.info("Successfully removed /var/log/glusterfs on client: %s",
+ self.mounts[0])
+
+ # Running IO on the mount point.
+ # Creating a dir on the mount point.
+ ret = mkdir(self.mounts[0].client_system,
+ self.mounts[0].mountpoint+"/dir")
+ self.assertTrue(ret, "Failed to create dir.")
+ g.log.info("dir created successfully for %s", self.mounts[0])
+
+ # Creating a file on the mount point.
+ cmd = ('touch %s/file' % self.mounts[0].mountpoint)
+ ret, _, _ = g.run(self.mounts[0].client_system, cmd)
+ self.assertEqual(ret, 0, "Failed to create file.")
+ g.log.info("file created successfully for %s", self.mounts[0])
+
+ # Unmounting and remounting volume.
+ ret, _, _ = umount_volume(mclient=self.mounts[0].client_system,
+ mpoint=self.mounts[0].mountpoint)
+ self.assertEqual(ret, 0,
+ ("Volume %s is not unmounted.") % self.volname)
+ g.log.info("Volume unmounted successfully : %s", self.volname)
+
+ ret, _, _ = mount_volume(self.volname, mtype=self.mount_type,
+ mpoint=self.mounts[0].mountpoint,
+ mserver=self.mnode,
+ mclient=self.mounts[0].client_system)
+ self.assertEqual(ret, 0, ("Volume %s is not mounted.") % self.volname)
+ g.log.info("Volume mounted successfully : %s", self.volname)
+
+ # Checking if logs are regenerated or not.
+ ret = get_dir_contents(self.mounts[0].client_system,
+ '/var/log/glusterfs/')
+ self.assertIsNotNone(ret, 'Log files were not regenerated.')
+ g.log.info("Log files were properly regenearted.")