summaryrefslogtreecommitdiffstats
path: root/tests/functional/glusterfind
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/glusterfind')
-rw-r--r--tests/functional/glusterfind/__init__.py0
-rw-r--r--tests/functional/glusterfind/test_gfind_create_cli.py130
-rw-r--r--tests/functional/glusterfind/test_gfind_delete_cli.py145
-rw-r--r--tests/functional/glusterfind/test_gfind_delete_file.py239
-rw-r--r--tests/functional/glusterfind/test_gfind_list_cli.py111
-rw-r--r--tests/functional/glusterfind/test_gfind_modify_files.py233
-rw-r--r--tests/functional/glusterfind/test_gfind_post_cli.py199
-rw-r--r--tests/functional/glusterfind/test_gfind_pre_cli.py204
-rw-r--r--tests/functional/glusterfind/test_gfind_query_cli.py164
-rw-r--r--tests/functional/glusterfind/test_gfind_rename.py231
-rw-r--r--tests/functional/glusterfind/test_gfind_type_option.py175
-rw-r--r--tests/functional/glusterfind/test_glusterfind_when_brick_down.py219
-rw-r--r--tests/functional/glusterfind/test_glusterfind_when_node_down.py280
13 files changed, 2330 insertions, 0 deletions
diff --git a/tests/functional/glusterfind/__init__.py b/tests/functional/glusterfind/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/functional/glusterfind/__init__.py
diff --git a/tests/functional/glusterfind/test_gfind_create_cli.py b/tests/functional/glusterfind/test_gfind_create_cli.py
new file mode 100644
index 000000000..fe5a56012
--- /dev/null
+++ b/tests/functional/glusterfind/test_gfind_create_cli.py
@@ -0,0 +1,130 @@
+# Copyright (C) 2019 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
+# the Free Software Foundation; either version 2 of the License, or
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY :or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+from glusto.core import Glusto as g
+from glustolibs.gluster.exceptions import ExecutionError
+from glustolibs.gluster.gluster_base_class import (GlusterBaseClass,
+ runs_on)
+from glustolibs.gluster.glusterfind_ops import (gfind_create, gfind_delete)
+
+
+@runs_on([['distributed-replicated', 'replicated', 'distributed',
+ 'dispersed', 'distributed-dispersed'],
+ ['glusterfs']])
+class TestGlusterFindCreateCLI(GlusterBaseClass):
+ """
+ GlusterFindCreateCLI contains tests which verifies the glusterfind create
+ command functionality.
+ """
+
+ def setUp(self):
+ """
+ setup volume for test case
+ """
+
+ # calling GlusterBaseClass setUpClass
+ self.get_super_method(self, 'setUp')()
+
+ # Setup Volume and Mount Volume
+ g.log.info("Starting to Setup %s", self.volname)
+ ret = self.setup_volume()
+ if not ret:
+ raise ExecutionError("Failed to Setup_Volume %s" % self.volname)
+ g.log.info("Successful in Setup Volume %s", self.volname)
+
+ def tearDown(self):
+ """
+ tearDown for every test
+ Clean up the volume
+ """
+
+ # Deleting the sessions created
+ sessionlist = ['validsession', 'validoptsession']
+ for sess in sessionlist:
+ ret, _, _ = gfind_delete(self.mnode, self.volname, sess)
+ if ret != 0:
+ raise ExecutionError("Failed to delete session '%s'" % sess)
+ g.log.info("Successfully deleted session '%s'", sess)
+
+ # stopping the volume
+ g.log.info("Starting to Cleanup Volume")
+ ret = self.cleanup_volume()
+ if not ret:
+ raise ExecutionError("Failed to Cleanup Volume")
+ g.log.info("Successful in Cleanup Volume")
+
+ # Calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
+
+ def test_gfind_create_cli(self):
+ """
+ Verifying the glusterfind create command functionality with valid
+ and invalid values for the required and optional parameters.
+
+ * Create a volume
+ * Create a session on the volume with the following combinations:
+ - Valid values for required parameters
+ - Invalid values for required parameters
+ - Valid values for optional parameters
+ - Invalid values for optional parameters
+
+ Required parameters: volname and sessname
+ Optional parameters: debug, force, reset-session-time
+ """
+
+ # pylint: disable=too-many-statements
+ # Create a session with valid inputs for required parameters
+ session1 = 'validsession'
+ g.log.info("Creating a session for the volume %s with valid values"
+ "for the required parameters", self.volname)
+ ret, _, _ = gfind_create(self.mnode, self.volname, session1)
+ self.assertEqual(ret, 0, ("Unexpected: Creation of a session for the "
+ "volume %s failed", self.volname))
+ g.log.info("Successful in validating the glusterfind create command "
+ "with valid values for required parameters")
+
+ # Create a session with invalid inputs for required parameters
+ session2 = 'invalidsession'
+ g.log.info("Creating a session with invalid values for the "
+ "required parameters")
+ ret, _, _ = gfind_create(self.mnode, 'invalidvolumename', session2)
+ self.assertNotEqual(ret, 0, ("Unexpected: Creation of a session is "
+ "Successful with invalid values"))
+ g.log.info("Successful in validating the glusterfind create command "
+ "with invalid values for required parameters")
+
+ # Create a session with valid inputs for optional parameters
+ session3 = 'validoptsession'
+ g.log.info("Creating a session for the volume %s with valid values"
+ "for the optional parameters", self.volname)
+ ret, _, _ = gfind_create(self.mnode, self.volname, session3,
+ force=True, resetsesstime=True, debug=True)
+ self.assertEqual(ret, 0, ("Unexpected: Creation of a session for the "
+ "volume %s failed", self.volname))
+ g.log.info("Successful in validating the glusterfind create command "
+ "with valid values for optional parameters")
+
+ # Create a session with invalid inputs for optional parameters
+ session4 = 'invalidoptsession'
+ g.log.info("Creating a session with invalid values for the "
+ "optional parameters")
+ cmd = ("glusterfind create %s %s --debg --frce --resetsessiontime"
+ % (session4, self.volname))
+ ret, _, _ = g.run(self.mnode, cmd)
+ self.assertNotEqual(ret, 0, ("Unexpected: Creation of a session is "
+ "Successful with invalid values"))
+ g.log.info("Successful in validating the glusterfind create command "
+ "with invalid values for required parameters")
diff --git a/tests/functional/glusterfind/test_gfind_delete_cli.py b/tests/functional/glusterfind/test_gfind_delete_cli.py
new file mode 100644
index 000000000..ac56c19b1
--- /dev/null
+++ b/tests/functional/glusterfind/test_gfind_delete_cli.py
@@ -0,0 +1,145 @@
+# Copyright (C) 2019 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
+# the Free Software Foundation; either version 2 of the License, or
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY :or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+from glusto.core import Glusto as g
+from glustolibs.gluster.exceptions import ExecutionError
+from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on
+from glustolibs.gluster.glusterfind_ops import (gfind_create,
+ gfind_list,
+ gfind_delete)
+
+
+@runs_on([['replicated', 'distributed-replicated', 'dispersed',
+ 'distributed', 'distributed-dispersed'],
+ ['glusterfs']])
+class GlusterFindDeleteCLI(GlusterBaseClass):
+ """
+ GlusterFindDeleteCLI contains tests which verifies the glusterfind delete
+ command functionality.
+ """
+
+ def setUp(self):
+ """
+ Setup volume and mount volume
+ """
+
+ # calling GlusterBaseClass setUp
+ self.get_super_method(self, 'setUp')()
+
+ # Setup Volume and Mount Volume
+ g.log.info("Starting to Setup %s", self.volname)
+ ret = self.setup_volume_and_mount_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Setup_Volume %s" % self.volname)
+ g.log.info("Successful in Setup Volume %s", self.volname)
+ self.session = 'test-session-%s' % self.volname
+
+ def tearDown(self):
+ """
+ Clean up the volume
+ """
+
+ # Check if glusterfind list contains any sessions
+ # If session exists, then delete it
+ g.log.info("Performing glusterfind list to check if the session "
+ "exists")
+ ret, _, _ = gfind_list(self.mnode, volname=self.volname,
+ sessname=self.session)
+ if ret == 0:
+ g.log.error("Unexpected: Glusterfind list shows existing session")
+ delret, _, _ = gfind_delete(self.mnode, self.volname, self.session)
+ if delret != 0:
+ raise ExecutionError("Failed to delete the session")
+ g.log.info("Successfully deleted the session")
+ g.log.info("Successful: No session is listed")
+
+ # stopping the volume
+ g.log.info("Starting to Cleanup Volume")
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Cleanup Volume")
+ g.log.info("Successful in Cleanup Volume")
+
+ # calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
+
+ def test_gfind_delete_cli(self):
+ """
+ Verifying the glusterfind delete command functionality with valid
+ and invalid values for the required and optional parameters.
+
+ * Create a volume
+ * Create a session on the volume
+ * Perform glusterfind list to check if session is created
+ * Delete the glusterfind session with the following combinations:
+ - Valid values for required parameters
+ - Invalid values for required parameters
+ - Valid values for optional parameters
+ - Invalid values for optional parameters
+ * Perform glusterfind list to check if session is deleted
+
+ Required parameters: volname and sessname
+ Optional parameters: debug
+ """
+
+ # pylint: disable=too-many-statements
+ # Creating a session for the volume
+ g.log.info("Creating a session for the volume %s", self.volname)
+ ret, _, _ = gfind_create(self.mnode, self.volname, self.session)
+ self.assertEqual(ret, 0, ("Unexpected: Creation of a session for the "
+ "volume %s failed" % self.volname))
+ g.log.info("Successfully created a session for the volume %s",
+ self.volname)
+
+ # Perform glusterfind list to check if session exists
+ g.log.info("Performing glusterfind list to check if the session is "
+ "created")
+ ret, _, _ = gfind_list(self.mnode, volname=self.volname,
+ sessname=self.session)
+ self.assertEqual(ret, 0, "Failed to list the glusterfind session")
+ g.log.info("Successfully listed the glusterfind session")
+
+ # Delete the glusterfind session using the invalid values for optional
+ # parameters
+ g.log.info("Deleting the session with invalid values for the optional "
+ "parameters")
+ ret, _, _ = g.run(self.mnode, ("glusterfind delete %s %s --dbug"
+ % (self.volname, self.session)))
+ self.assertNotEqual(ret, 0, "Unexpected: glusterfind session deleted "
+ "even with invalid value for optional parameters")
+ g.log.info("Successful: glusterfind delete failed with invalid value "
+ "for optional parameters")
+
+ # Delete the glusterfind session using the valid values for required
+ # and optional parameters
+ g.log.info("Deleting the session with valid values for the required "
+ "and optional parameters")
+ ret, _, _ = gfind_delete(self.mnode, self.volname, self.session,
+ debug=True)
+ self.assertEqual(ret, 0, "Unexpected: Failed to delete the session "
+ "using the valid values for the required and "
+ "optional parameters")
+ g.log.info("Successfully deleted the session using valid values for "
+ "required and optional parameters")
+
+ # Perform glusterfind list to check if the session exists
+ g.log.info("Performing glusterfind list to validate that the session "
+ "is deleted")
+ ret, _, _ = gfind_list(self.mnode, volname=self.volname,
+ sessname=self.session)
+ self.assertNotEqual(ret, 0, "Unexpected: glusterfind sessions is being"
+ " listed even after being deleted")
+ g.log.info("Successful: No glusterfind session is listed")
diff --git a/tests/functional/glusterfind/test_gfind_delete_file.py b/tests/functional/glusterfind/test_gfind_delete_file.py
new file mode 100644
index 000000000..df02184b5
--- /dev/null
+++ b/tests/functional/glusterfind/test_gfind_delete_file.py
@@ -0,0 +1,239 @@
+# Copyright (C) 2019 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
+# the Free Software Foundation; either version 2 of the License, or
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY :or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+from time import sleep
+from glusto.core import Glusto as g
+from glustolibs.gluster.exceptions import ExecutionError
+from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on
+from glustolibs.gluster.volume_ops import set_volume_options, volume_reset
+from glustolibs.gluster.glusterfind_ops import (gfind_create,
+ gfind_list,
+ gfind_pre,
+ gfind_post,
+ gfind_delete)
+from glustolibs.gluster.glusterfile import (file_exists, remove_file,
+ check_if_pattern_in_file)
+
+
+@runs_on([['replicated', 'distributed-replicated', 'dispersed',
+ 'distributed', 'distributed-dispersed'],
+ ['glusterfs']])
+class TestGlusterFindDeletes(GlusterBaseClass):
+ """
+ TestGlusterFindDeletes contains tests which verifies the
+ glusterfind functionality with renames of files.
+ """
+
+ def setUp(self):
+ """
+ setup volume and mount volume
+ Initiate necessary variables
+ """
+
+ # calling GlusterBaseClass setUp
+ self.get_super_method(self, 'setUp')()
+
+ # Setup Volume and Mount Volume
+ g.log.info("Starting to Setup %s", self.volname)
+ ret = self.setup_volume_and_mount_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Setup_Volume %s" % self.volname)
+ g.log.info("Successful in Setup Volume %s", self.volname)
+ self.session = 'test-session-%s' % self.volname
+ self.outfiles = [('/tmp/test-outfile-%s-%s.txt'
+ % (self.volname, i))for i in range(0, 2)]
+
+ # Set the changelog rollover-time to 1 second
+ g.log.info("Setting the changelog rollover-time to 1 second")
+ option = {'changelog.rollover-time': '1'}
+ ret = set_volume_options(self.mnode, self.volname, option)
+ if not ret:
+ raise ExecutionError("Failed to set the volume option %s for %s"
+ % (option, self.volname))
+ g.log.info("Successfully set the volume option for the volume %s",
+ self.volname)
+
+ def tearDown(self):
+ """
+ tearDown for every test
+ Clean up and unmount the volume
+ """
+
+ ret, _, _ = gfind_delete(self.mnode, self.volname, self.session)
+ if ret != 0:
+ raise ExecutionError("Failed to delete session %s" % self.session)
+ g.log.info("Successfully deleted session %s", self.session)
+
+ g.log.info("Removing the outfiles created during 'glusterfind pre'")
+ for out in self.outfiles:
+ ret = remove_file(self.mnode, out, force=True)
+ if not ret:
+ raise ExecutionError("Failed to remove the outfile %s" % out)
+ g.log.info("Successfully removed the outfiles")
+
+ # Reset the volume
+ g.log.info("Reset the volume")
+ ret, _, _ = volume_reset(self.mnode, self.volname)
+ if ret != 0:
+ raise ExecutionError("Failed to reset the volume %s"
+ % self.volname)
+ g.log.info("Successfully reset the volume %s", self.volname)
+
+ # Cleanup the volume
+ g.log.info("Starting to Cleanup Volume")
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Cleanup Volume")
+ g.log.info("Successful in Cleanup Volume")
+
+ # calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
+
+ def test_gfind_deletes(self):
+ """
+ Verifying the glusterfind functionality with deletion of files.
+
+ * Create a volume
+ * Create a session on the volume
+ * Create various files from mount point
+ * Perform glusterfind pre
+ * Perform glusterfind post
+ * Check the contents of outfile
+ * Delete the files created from mount point
+ * Perform glusterfind pre
+ * Perform glusterfind post
+ * Check the contents of outfile
+ Files deleted must be listed
+ """
+
+ # pylint: disable=too-many-statements
+ # Creating a session for the volume
+ g.log.info("Creating a session for the volume %s", self.volname)
+ ret, _, _ = gfind_create(self.mnode, self.volname, self.session)
+ self.assertEqual(ret, 0, ("Unexpected: Creation of a session for the "
+ "volume %s failed" % self.volname))
+ g.log.info("Successfully created a session for the volume %s",
+ self.volname)
+
+ # Perform glusterfind list to check if session exists
+ g.log.info("Performing glusterfind list to check if the session is "
+ "created")
+ ret, _, _ = gfind_list(self.mnode, volname=self.volname,
+ sessname=self.session)
+ self.assertEqual(ret, 0, "Failed to list the glusterfind session")
+ g.log.info("Successfully listed the glusterfind session")
+
+ # Starting IO on the mounts
+ g.log.info("Creating Files on %s:%s",
+ self.mounts[0].client_system, self.mounts[0].mountpoint)
+ cmd = ("cd %s ; for i in `seq 1 10` ; "
+ "do dd if=/dev/urandom of=file$i bs=1M count=1 ; "
+ "done" % self.mounts[0].mountpoint)
+ ret, _, _ = g.run(self.mounts[0].client_system, cmd)
+ self.assertEqual(ret, 0, "Failed to create files on mountpoint")
+ g.log.info("Files created successfully on mountpoint")
+
+ # Check if the files exist
+ g.log.info("Checking the existence of files created during IO")
+ for i in range(1, 11):
+ ret = file_exists(self.mounts[0].client_system,
+ '%s/file%s' % (self.mounts[0].mountpoint, i))
+ self.assertTrue(ret, "Unexpected: File 'file%s' does not exist"
+ % i)
+ g.log.info("Successfully validated existence of 'file%s'", i)
+
+ sleep(5)
+
+ # Perform glusterfind pre for the session
+ g.log.info("Performing glusterfind pre for the session %s",
+ self.session)
+ ret, _, _ = gfind_pre(self.mnode, self.volname, self.session,
+ self.outfiles[0], full=True, noencode=True,
+ debug=True)
+ self.assertEqual(ret, 0, ("Failed to perform glusterfind pre"))
+ g.log.info("Successfully performed glusterfind pre")
+
+ # Check if the outfile exists
+ g.log.info("Checking if outfile created during glusterfind pre command"
+ " exists")
+ ret = file_exists(self.mnode, self.outfiles[0])
+ self.assertTrue(ret, "Unexpected: File '%s' does not exist"
+ % self.outfiles[0])
+ g.log.info("Successfully validated existence of '%s'",
+ self.outfiles[0])
+
+ # Check if all the files are listed in the outfile
+ for i in range(1, 11):
+ ret = check_if_pattern_in_file(self.mnode, 'file%s' % i,
+ self.outfiles[0])
+ self.assertEqual(ret, 0, ("File 'file%s' not listed in %s"
+ % (i, self.outfiles[0])))
+ g.log.info("File 'file%s' listed in %s", i, self.outfiles[0])
+
+ # Perform glusterfind post for the session
+ g.log.info("Performing glusterfind post for the session %s",
+ self.session)
+ ret, _, _ = gfind_post(self.mnode, self.volname, self.session)
+ self.assertEqual(ret, 0, ("Failed to perform glusterfind post"))
+ g.log.info("Successfully performed glusterfind post")
+
+ # Delete the files created from mount point
+ g.log.info("Deleting the Files on %s:%s",
+ self.mounts[0].client_system, self.mounts[0].mountpoint)
+ for i in range(1, 11):
+ ret = remove_file(self.mounts[0].client_system,
+ "%s/file%s" % (self.mounts[0].mountpoint, i),
+ force=True)
+ self.assertTrue(ret, "Failed to delete file%s" % i)
+ g.log.info("Successfully deleted all the files")
+
+ # Check if the files deleted exist from mount point
+ g.log.info("Checking the existence of files that were deleted "
+ "(must not be present)")
+ for i in range(1, 11):
+ ret = file_exists(self.mounts[0].client_system,
+ '%s/file%s' % (self.mounts[0].mountpoint, i))
+ self.assertFalse(ret, "Unexpected: File 'file%s' exists even after"
+ " being deleted" % i)
+ g.log.info("Successfully validated 'file%s' does not exist", i)
+
+ sleep(5)
+
+ # Perform glusterfind pre for the session
+ g.log.info("Performing glusterfind pre for the session %s",
+ self.session)
+ ret, _, _ = gfind_pre(self.mnode, self.volname, self.session,
+ self.outfiles[1], debug=True)
+ self.assertEqual(ret, 0, ("Failed to perform glusterfind pre"))
+ g.log.info("Successfully performed glusterfind pre")
+
+ # Check if the outfile exists
+ g.log.info("Checking if outfile created during glusterfind pre command"
+ " exists")
+ ret = file_exists(self.mnode, self.outfiles[1])
+ self.assertTrue(ret, "Unexpected: File '%s' does not exist"
+ % self.outfiles[1])
+ g.log.info("Successfully validated existence of '%s'",
+ self.outfiles[1])
+
+ # Check if all the files are listed in the outfile
+ for i in range(1, 11):
+ pattern = "DELETE file%s" % i
+ ret = check_if_pattern_in_file(self.mnode, pattern,
+ self.outfiles[1])
+ self.assertEqual(ret, 0, ("File 'file%s' not listed in %s"
+ % (i, self.outfiles[1])))
+ g.log.info("File 'file%s' listed in %s", i, self.outfiles[1])
diff --git a/tests/functional/glusterfind/test_gfind_list_cli.py b/tests/functional/glusterfind/test_gfind_list_cli.py
new file mode 100644
index 000000000..bfc27da97
--- /dev/null
+++ b/tests/functional/glusterfind/test_gfind_list_cli.py
@@ -0,0 +1,111 @@
+# Copyright (C) 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
+# the Free Software Foundation; either version 2 of the License, or
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along`
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+from glusto.core import Glusto as g
+from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on
+from glustolibs.gluster.exceptions import ExecutionError
+from glustolibs.gluster.glusterfind_ops import (gfind_list, gfind_create,
+ gfind_delete)
+
+
+@runs_on([['distributed-replicated', 'distributed-arbiter',
+ 'distributed-dispersed', 'distributed', 'arbiter',
+ 'dispersed', 'replicated'], ['glusterfs']])
+class TestGlusterFindListCLI(GlusterBaseClass):
+
+ def setUp(self):
+
+ self.get_super_method(self, 'setUp')()
+
+ # Setup Volume
+ if not self.setup_volume():
+ raise ExecutionError("Failed to Setup_Volume %s" % self.volname)
+
+ def tearDown(self):
+
+ # Cleanup glusterfind session and volume
+ ret, _, _ = gfind_delete(self.mnode, self.volname, self.session)
+ if ret:
+ raise ExecutionError("Failed to delete session '%s'"
+ % self.session)
+
+ if not self.cleanup_volume():
+ raise ExecutionError("Failed to Cleanup Volume")
+
+ # Calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
+
+ def _check_glusterfind_list_output(self, out):
+ """Check if glusterfind list output is proper or not."""
+ out = list(
+ filter(None, list(filter(None, out.split("\n")))[2].split(" ")))
+ self.assertEqual(out[0], self.session,
+ "Unexpected: Session name not poper in output")
+ self.assertEqual(out[1], self.volname,
+ "Unecpected: Volume name not proper in output")
+
+ def test_gfind_list_cli(self):
+ """
+ Verifying the glusterfind list command functionality with valid
+ and invalid values for the required and optional parameters.
+
+ * Create a volume
+ * Create a session on the volume and call glusterfind list with the
+ following combinations:
+ - Valid values for optional parameters
+ - Invalid values for optional parameters
+
+ NOTE:
+ There are no required parameters for glusterfind list command.
+ """
+ # Creating a glusterfind session
+ self.session = "session1"
+ ret, _, _ = gfind_create(self.mnode, self.volname, self.session)
+ self.assertEqual(ret, 0, "Glusterfind session creation for the "
+ "volume %s failed" % self.volname)
+
+ # Checking output of glusterfind list
+ ret, out, _ = gfind_list(self.mnode)
+ self.assertEqual(ret, 0, "Glusterfind list failed")
+ self._check_glusterfind_list_output(out)
+ g.log.info("glusterfind list cmd validation without any param passed")
+
+ # Check output for glusterfind list with valid and invalid volume name
+ for volume, expected_value, validation in ((self.volname, 0, 'valid'),
+ ("abc", 1, 'invalid')):
+ ret, out, _ = gfind_list(self.mnode, volname=volume)
+ self.assertEqual(ret, expected_value,
+ "Glusterfind list --volume check with %s "
+ "parameter failed" % validation)
+ if not ret:
+ self._check_glusterfind_list_output(out)
+ g.log.info("glusterind list cmd check with --volume param passed")
+
+ # Check output for glusterfind list with valid and invalid session name
+ for session, expected_value, validation in ((self.session, 0, 'valid'),
+ ("abc", 1, 'invalid')):
+ ret, out, _ = gfind_list(self.mnode, sessname=session)
+ self.assertEqual(ret, expected_value,
+ "Glusterfind list --session check with %s "
+ "parameter failed" % validation)
+ if not ret:
+ self._check_glusterfind_list_output(out)
+ g.log.info("glusterfind list cmd check with --session param passed")
+
+ # Check output of glusterind list with debug parameter
+ ret, _, _ = gfind_list(self.mnode, debug=True)
+ self.assertEqual(ret, 0, "Glusterfind list --debug parameter failed")
+ g.log.info("glusterfind list cmd check with --debug param passed")
diff --git a/tests/functional/glusterfind/test_gfind_modify_files.py b/tests/functional/glusterfind/test_gfind_modify_files.py
new file mode 100644
index 000000000..b86625f15
--- /dev/null
+++ b/tests/functional/glusterfind/test_gfind_modify_files.py
@@ -0,0 +1,233 @@
+# Copyright (C) 2019-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
+# the Free Software Foundation; either version 2 of the License, or
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY :or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+from time import sleep
+from glusto.core import Glusto as g
+from glustolibs.gluster.exceptions import ExecutionError
+from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on
+from glustolibs.gluster.volume_ops import (
+ set_volume_options,
+ volume_reset)
+from glustolibs.gluster.lib_utils import (
+ append_string_to_file,
+ list_files)
+from glustolibs.gluster.glusterfile import (
+ file_exists,
+ remove_file,
+ check_if_pattern_in_file)
+from glustolibs.gluster.glusterfind_ops import (
+ gfind_create,
+ gfind_list,
+ gfind_pre,
+ gfind_post,
+ gfind_delete)
+
+
+@runs_on([["replicated", "distributed-replicated", "dispersed",
+ "distributed", "distributed-dispersed"],
+ ["glusterfs"]])
+class TestGlusterFindModify(GlusterBaseClass):
+ """
+ TestGlusterFindModify contains tests which verifies the
+ glusterfind functionality with modification of files.
+ """
+
+ def setUp(self):
+ """
+ setup volume and mount volume
+ Initiate necessary variables
+ """
+
+ # calling GlusterBaseClass setUp
+ self.get_super_method(self, 'setUp')()
+
+ # Setup Volume and Mount Volume
+ g.log.info("Starting to Setup %s", self.volname)
+ ret = self.setup_volume_and_mount_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Setup_Volume %s" % self.volname)
+ g.log.info("Successful in Setup Volume %s", self.volname)
+ self.session = "test-session-%s" % self.volname
+ self.outfiles = [("/tmp/test-outfile-%s-%s.txt"
+ % (self.volname, i))for i in range(0, 2)]
+
+ # Set the changelog rollover-time to 1 second
+ # This needs to be done in order for glusterfind to keep checking
+ # for changes in the mount point
+ option = {'changelog.rollover-time': '1'}
+ ret = set_volume_options(self.mnode, self.volname, option)
+ if not ret:
+ raise ExecutionError("Failed to set the volume option %s for %s"
+ % (option, self.volname))
+ g.log.info("Successfully set the volume option for the volume %s",
+ self.volname)
+
+ def tearDown(self):
+ """
+ tearDown for every test
+ Clean up and unmount the volume
+ """
+ # calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
+
+ # Delete the glusterfind sessions
+ ret, _, _ = gfind_delete(self.mnode, self.volname, self.session)
+ if ret:
+ raise ExecutionError("Failed to delete session %s" % self.session)
+ g.log.info("Successfully deleted session %s", self.session)
+
+ # Remove the outfiles created during 'glusterfind pre'
+ for out in self.outfiles:
+ ret = remove_file(self.mnode, out, force=True)
+ if not ret:
+ raise ExecutionError("Failed to remove the outfile %s" % out)
+ g.log.info("Successfully removed the outfiles")
+
+ # Reset the volume
+ ret, _, _ = volume_reset(self.mnode, self.volname)
+ if ret:
+ raise ExecutionError("Failed to reset the volume %s"
+ % self.volname)
+ g.log.info("Successfully reset the volume %s", self.volname)
+
+ # Cleanup the volume
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Cleanup Volume")
+ g.log.info("Successful in Cleanup Volume")
+
+ def test_gfind_modify(self):
+ """
+ Verifying the glusterfind functionality with deletion of files.
+
+ * Create a volume
+ * Create a session on the volume
+ * Create various files from mount point
+ * Perform glusterfind pre
+ * Perform glusterfind post
+ * Check the contents of outfile
+ * Modify the contents of the files from mount point
+ * Perform glusterfind pre
+ * Perform glusterfind post
+ * Check the contents of outfile
+ Files modified must be listed
+ """
+
+ # pylint: disable=too-many-statements
+ # Create a session for the volume
+ ret, _, _ = gfind_create(self.mnode, self.volname, self.session)
+ self.assertEqual(ret, 0, ("Unexpected: Creation of a session for the "
+ "volume %s failed" % self.volname))
+ g.log.info("Successfully created a session for the volume %s",
+ self.volname)
+
+ # Perform glusterfind list to check if session exists
+ _, out, _ = gfind_list(self.mnode, volname=self.volname,
+ sessname=self.session)
+ self.assertNotEqual(out, "No sessions found.",
+ "Failed to list the glusterfind session")
+ g.log.info("Successfully listed the glusterfind session")
+
+ # Starting IO on the mounts
+ cmd = "cd %s ; touch file{1..10}" % self.mounts[0].mountpoint
+ ret, _, _ = g.run(self.mounts[0].client_system, cmd)
+ self.assertEqual(ret, 0, "Failed to create files on mountpoint")
+ g.log.info("Files created successfully on mountpoint")
+
+ # Gather the list of files from the mount point
+ files = list_files(self.mounts[0].client_system,
+ self.mounts[0].mountpoint)
+ self.assertIsNotNone(files, "Failed to get the list of files")
+ g.log.info("Successfully gathered the list of files from mount point")
+
+ # Check if the files exist
+ for filename in files:
+ ret = file_exists(self.mounts[0].client_system, filename)
+ self.assertTrue(ret, ("Unexpected: File '%s' does not exist"
+ % filename))
+ g.log.info("Successfully validated existence of '%s'", filename)
+
+ # Wait for changelog to get updated
+ sleep(2)
+
+ # Perform glusterfind pre for the session
+ ret, _, _ = gfind_pre(self.mnode, self.volname, self.session,
+ self.outfiles[0], full=True, noencode=True,
+ debug=True)
+ self.assertEqual(ret, 0, ("Failed to perform glusterfind pre"))
+ g.log.info("Successfully performed glusterfind pre")
+
+ # Check if the outfile exists
+ ret = file_exists(self.mnode, self.outfiles[0])
+ self.assertTrue(ret, ("Unexpected: File '%s' does not exist"
+ % self.outfiles[0]))
+ g.log.info("Successfully validated existence of '%s'",
+ self.outfiles[0])
+
+ # Check if all the files are listed in the outfile
+ for i in range(1, 11):
+ ret = check_if_pattern_in_file(self.mnode, "file%s" % i,
+ self.outfiles[0])
+ self.assertEqual(ret, 0, ("File 'file%s' not listed in %s"
+ % (i, self.outfiles[0])))
+ g.log.info("File 'file%s' listed in %s", i, self.outfiles[0])
+
+ # Perform glusterfind post for the session
+ ret, _, _ = gfind_post(self.mnode, self.volname, self.session)
+ self.assertEqual(ret, 0, ("Failed to perform glusterfind post"))
+ g.log.info("Successfully performed glusterfind post")
+
+ # Modify the files created from mount point
+ mod_string = "this is a test string\n"
+ for filenum in files:
+ ret = append_string_to_file(self.mounts[0].client_system, filenum,
+ mod_string)
+ self.assertTrue(ret, "Failed to append to file '%s'" % filenum)
+ g.log.info("Successfully modified all the files")
+
+ # Check if the files modified exist from mount point
+ for filenum in files:
+ ret = check_if_pattern_in_file(self.mounts[0].client_system,
+ mod_string, filenum)
+ self.assertEqual(ret, 0, ("Unexpected: File '%s' does not contain"
+ " the string '%s' after being modified"
+ % (filenum, mod_string)))
+ g.log.info("Successfully validated '%s' is modified", filenum)
+
+ # Wait for changelog to get updated
+ sleep(2)
+
+ # Perform glusterfind pre for the session
+ ret, _, _ = gfind_pre(self.mnode, self.volname, self.session,
+ self.outfiles[1], debug=True)
+ self.assertEqual(ret, 0, ("Failed to perform glusterfind pre"))
+ g.log.info("Successfully performed glusterfind pre")
+
+ # Check if the outfile exists
+ ret = file_exists(self.mnode, self.outfiles[1])
+ self.assertTrue(ret, ("Unexpected: File '%s' does not exist"
+ % self.outfiles[1]))
+ g.log.info("Successfully validated existence of outfile '%s'",
+ self.outfiles[1])
+
+ # Check if all the files are listed in the outfile
+ for num in range(1, 11):
+ pattern = "MODIFY file%s" % num
+ ret = check_if_pattern_in_file(self.mnode, pattern,
+ self.outfiles[1])
+ self.assertEqual(ret, 0, ("File 'file%s' not listed in '%s'"
+ % (num, self.outfiles[1])))
+ g.log.info("File 'file%s' listed in '%s'", num, self.outfiles[1])
diff --git a/tests/functional/glusterfind/test_gfind_post_cli.py b/tests/functional/glusterfind/test_gfind_post_cli.py
new file mode 100644
index 000000000..0daf46201
--- /dev/null
+++ b/tests/functional/glusterfind/test_gfind_post_cli.py
@@ -0,0 +1,199 @@
+# Copyright (C) 2019 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
+# the Free Software Foundation; either version 2 of the License, or
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY :or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+from glusto.core import Glusto as g
+from glustolibs.gluster.exceptions import ExecutionError
+from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on
+from glustolibs.gluster.glusterfind_ops import (gfind_create,
+ gfind_list,
+ gfind_pre,
+ gfind_post,
+ gfind_delete)
+from glustolibs.gluster.glusterfile import (file_exists, remove_file,
+ check_if_pattern_in_file)
+
+
+@runs_on([['replicated', 'distributed-replicated', 'dispersed',
+ 'distributed', 'distributed-dispersed'],
+ ['glusterfs']])
+class TestGlusterFindPostCLI(GlusterBaseClass):
+ """
+ GlusterFindPostCLI contains tests which verifies the glusterfind post
+ command functionality.
+ """
+
+ def setUp(self):
+ """
+ setup volume and mount volume
+ Initiate the necessary variables
+ """
+
+ # calling GlusterBaseClass setUpClass
+ self.get_super_method(self, 'setUp')()
+
+ # Setup Volume and Mount Volume
+ g.log.info("Starting to Setup %s", self.volname)
+ ret = self.setup_volume_and_mount_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Setup_Volume %s" % self.volname)
+ g.log.info("Successful in Setup Volume %s", self.volname)
+ self.session = 'test-session-for-post-%s' % self.volname
+ self.outfile = '/tmp/test-outfile-%s.txt' % self.volname
+
+ def tearDown(self):
+ """
+ tearDown for every test and Clean up and unmount the volume
+ """
+
+ g.log.info("Deleting the glusterfind session")
+ ret, _, _ = gfind_delete(self.mnode, self.volname, self.session)
+ if ret != 0:
+ raise ExecutionError("Failed to delete session %s" % self.session)
+ g.log.info("Successfully deleted session %s", self.session)
+
+ g.log.info("Removing the outfile created during 'glusterfind pre'")
+ ret = remove_file(self.mnode, self.outfile, force=True)
+ if not ret:
+ raise ExecutionError("Failed to remove the outfile")
+ g.log.info("Successfully removed the outfile")
+
+ # stopping the volume
+ g.log.info("Starting to Cleanup Volume")
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Cleanup Volume")
+ g.log.info("Successful in Cleanup Volume")
+
+ # calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
+
+ def test_gfind_post_cli(self):
+ """
+ Verifying the glusterfind post command functionality with valid
+ and invalid values for the required and optional parameters.
+
+ * Create a volume
+ * Create a session on the volume
+ * Perform some I/O from the mount point
+ * Perform glusterfind pre
+ * Perform glusterfind post with the following combinations:
+ - Valid values for required parameters
+ - Invalid values for required parameters
+ - Valid values for optional parameters
+ - Invalid values for optional parameters
+
+ Where
+ Required parameters: volname and sessname
+ Optional parameters: debug
+ """
+
+ # pylint: disable=too-many-statements
+ # Creating a session for the volume
+ g.log.info("Creating a session for the volume %s", self.volname)
+ ret, _, _ = gfind_create(self.mnode, self.volname, self.session)
+ self.assertEqual(ret, 0, ("Unexpected: Creation of a session for the "
+ "volume %s failed" % self.volname))
+ g.log.info("Successfully created a session for the volume %s",
+ self.volname)
+
+ # Perform glusterfind list to check if session exists
+ g.log.info("Performing glusterfind list to check if the session is "
+ "created")
+ ret, _, _ = gfind_list(self.mnode, volname=self.volname,
+ sessname=self.session)
+ self.assertEqual(ret, 0, "Failed to list the glusterfind session")
+ g.log.info("Successfully listed the glusterfind session")
+
+ # Starting IO on the mounts
+ mount_obj = self.mounts[0]
+ mount_dir = mount_obj.mountpoint
+ client = mount_obj.client_system
+
+ g.log.info("Creating Files on %s:%s", client, mount_dir)
+ cmd = ("cd %s ; for i in `seq 1 10` ; "
+ "do dd if=/dev/urandom of=file$i bs=1M count=1 ; "
+ "done" % mount_dir)
+ ret, _, _ = g.run(client, cmd)
+ self.assertEqual(ret, 0, "Failed to create files on mountpoint")
+ g.log.info("Files created successfully on mountpoint")
+
+ # Check if the files exist
+ g.log.info("Checking the existence of files created during IO")
+ for i in range(1, 11):
+ ret = file_exists(client, '%s/file%s' % (mount_dir, i))
+ self.assertTrue(ret, "Unexpected: File 'file%s' does not exist"
+ % i)
+ g.log.info("Successfully validated existence of 'file%s'", i)
+
+ # Perform glusterfind pre for the session
+ g.log.info("Performing glusterfind pre for the session %s",
+ self.session)
+ ret, _, _ = gfind_pre(self.mnode, self.volname, self.session,
+ self.outfile, full=True, noencode=True,
+ debug=True)
+ self.assertEqual(ret, 0, ("Failed to perform glusterfind pre"))
+ g.log.info("Successfully performed glusterfind pre")
+
+ # Check if the outfile exists
+ g.log.info("Checking if outfile created during glusterfind pre command"
+ " exists")
+ ret = file_exists(self.mnode, self.outfile)
+ self.assertTrue(ret, "Unexpected: File '%s' does not exist"
+ % self.outfile)
+ g.log.info("Successfully validated existence of '%s'", self.outfile)
+
+ # Check if all the files are listed in the outfile
+ for i in range(1, 11):
+ ret = check_if_pattern_in_file(self.mnode,
+ 'file%s' % i, self.outfile)
+ self.assertEqual(ret, 0,
+ ("File 'file%s' not listed in %s"
+ % (i, self.outfile)))
+ g.log.info("File 'file%s' listed in %s", i, self.outfile)
+
+ # Perform glusterfind post using invalid values for the rquired
+ # parameters
+ not_volume = 'invalid-volume-name'
+ not_session = 'invalid-session-name'
+ g.log.info("Performing glusterfind post with invalid values for the "
+ "required parameters")
+ ret, _, _ = gfind_post(self.mnode, not_volume, not_session)
+ self.assertNotEqual(ret, 0,
+ ("Unexpected: Successfully performed glusterfind "
+ "post with invalid values for required "
+ "parameters"))
+ g.log.info("Successful: glusterfind post failed with invalid values "
+ "for required parameters")
+
+ # Perform glusterfind post using the invalid values for optional
+ # parameters
+ g.log.info("Deleting the session with invalid values for the optional "
+ "parameters")
+ ret, _, _ = g.run(self.mnode, ("glusterfind post %s %s --dbug"
+ % (self.volname, self.session)))
+ self.assertNotEqual(ret, 0, "Unexpected: glusterfind post Successful "
+ "with invalid value for optional parameters")
+ g.log.info("Successful: glusterfind post failed with invalid value "
+ "for optional parameters")
+
+ # Performing glusterfind post with valid values for optional and
+ # required parameters
+ g.log.info("Performing glusterfind post with invalid values for the "
+ "required parameters")
+ ret, _, _ = gfind_post(self.mnode, self.volname, self.session,
+ debug=True)
+ self.assertEqual(ret, 0, ("Failed to perform glusterfind post"))
+ g.log.info("Successfully performed glusterfind post")
diff --git a/tests/functional/glusterfind/test_gfind_pre_cli.py b/tests/functional/glusterfind/test_gfind_pre_cli.py
new file mode 100644
index 000000000..8165bad7f
--- /dev/null
+++ b/tests/functional/glusterfind/test_gfind_pre_cli.py
@@ -0,0 +1,204 @@
+# Copyright (C) 2019 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
+# the Free Software Foundation; either version 2 of the License, or
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY :or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+from glusto.core import Glusto as g
+from glustolibs.gluster.exceptions import ExecutionError
+from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on
+from glustolibs.gluster.glusterfind_ops import (gfind_create,
+ gfind_list,
+ gfind_pre,
+ gfind_post,
+ gfind_delete)
+from glustolibs.gluster.glusterfile import (file_exists, remove_file,
+ check_if_pattern_in_file)
+
+
+@runs_on([['replicated', 'distributed-replicated', 'dispersed',
+ 'distributed', 'distributed-dispersed'],
+ ['glusterfs']])
+class TestGlusterFindPreCLI(GlusterBaseClass):
+ """
+ GlusterFindPreCLI contains tests which verifies the glusterfind pre
+ command functionality.
+ """
+
+ def setUp(self):
+ """
+ setup volume and mount volume
+ Initiate necessary variables
+ """
+
+ # calling GlusterBaseClass setUp
+ self.get_super_method(self, 'setUp')()
+
+ # Setup Volume and Mount Volume
+ g.log.info("Starting to Setup %s", self.volname)
+ ret = self.setup_volume_and_mount_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Setup_Volume %s" % self.volname)
+ g.log.info("Successful in Setup Volume %s", self.volname)
+ self.session = 'test-session-%s' % self.volname
+ self.outfile = '/tmp/test-outfile-%s.txt' % self.volname
+
+ def tearDown(self):
+ """
+ tearDown for every test
+ Clean up and unmount the volume
+ """
+
+ ret, _, _ = gfind_delete(self.mnode, self.volname, self.session)
+ if ret != 0:
+ raise ExecutionError("Failed to delete session %s" % self.session)
+ g.log.info("Successfully deleted session %s", self.session)
+
+ g.log.info("Removing the outfile created during 'glusterfind pre'")
+ ret = remove_file(self.mnode, self.outfile, force=True)
+ if not ret:
+ raise ExecutionError("Failed to remove the outfile")
+ g.log.info("Successfully removed the outfile")
+
+ # stopping the volume
+ g.log.info("Starting to Cleanup Volume")
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Cleanup Volume")
+ g.log.info("Successful in Cleanup Volume")
+
+ # calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
+
+ def test_gfind_pre_cli(self):
+ """
+ Verifying the glusterfind pre command functionality with valid
+ and invalid values for the required and optional parameters.
+
+ * Create a volume
+ * Create a session on the volume
+ * Perform some I/O from the mount point
+ * Perform glusterfind pre with the following combinations:
+ - Valid values for required parameters
+ - Invalid values for required parameters
+ - Valid values for optional parameters
+ - Invalid values for optional parameters
+ * Perform glusterfind post
+
+ Where
+ Required parameters: volname, sessname and outfile
+ Optional parameters: full, debug, gftype, tagforfullfind,
+ namespace, noencode, disablepartial,
+ regenoutfile, outprefix, fieldsep
+ """
+
+ # pylint: disable=too-many-statements
+ # Creating a session for the volume
+ g.log.info("Creating a session for the volume %s", self.volname)
+ ret, _, _ = gfind_create(self.mnode, self.volname, self.session)
+ self.assertEqual(ret, 0, ("Unexpected: Creation of a session for the "
+ "volume %s failed" % self.volname))
+ g.log.info("Successfully created a session for the volume %s",
+ self.volname)
+
+ # Perform glusterfind list to check if session exists
+ g.log.info("Performing glusterfind list to check if the session is "
+ "created")
+ ret, _, _ = gfind_list(self.mnode, volname=self.volname,
+ sessname=self.session)
+ self.assertEqual(ret, 0, "Failed to list the glusterfind session")
+ g.log.info("Successfully listed the glusterfind session")
+
+ # Starting IO on the mounts
+ mount_obj = self.mounts[0]
+ mount_dir = mount_obj.mountpoint
+ client = mount_obj.client_system
+
+ g.log.info("Creating Files on %s:%s", client, mount_dir)
+ cmd = ("cd %s ; for i in `seq 1 10` ; "
+ "do dd if=/dev/urandom of=file$i bs=1M count=1 ; "
+ "done" % mount_dir)
+ ret, _, _ = g.run(client, cmd)
+ self.assertEqual(ret, 0, "Failed to create files on mountpoint")
+ g.log.info("Files created successfully on mountpoint")
+
+ # Check if the files exist
+ g.log.info("Checking the existence of files created during IO")
+ for i in range(1, 11):
+ ret = file_exists(client, '%s/file%s' % (mount_dir, i))
+ self.assertTrue(ret, "Unexpected: File 'file%s' does not exist"
+ % i)
+ g.log.info("Successfully validated existence of 'file%s'", i)
+
+ # Perform glusterfind pre for the session
+ g.log.info("Performing glusterfind pre for the session %s",
+ self.session)
+ ret, _, _ = gfind_pre(self.mnode, self.volname, self.session,
+ self.outfile, full=True, noencode=True,
+ debug=True)
+ self.assertEqual(ret, 0, ("Failed to perform glusterfind pre"))
+ g.log.info("Successfully performed glusterfind pre")
+
+ # Check if the outfile exists
+ g.log.info("Checking if outfile created during glusterfind pre command"
+ " exists")
+ ret = file_exists(self.mnode, self.outfile)
+ self.assertTrue(ret, "Unexpected: File '%s' does not exist"
+ % self.outfile)
+ g.log.info("Successfully validated existence of '%s'", self.outfile)
+
+ # Check if all the files are listed in the outfile
+ for i in range(1, 11):
+ ret = check_if_pattern_in_file(self.mnode, 'file%s' % i,
+ self.outfile)
+ self.assertEqual(ret, 0,
+ ("File 'file%s' not listed in %s"
+ % (i, self.outfile)))
+ g.log.info("File 'file%s' listed in %s", i, self.outfile)
+
+ # Perform glusterfind post for the session
+ g.log.info("Performing glusterfind post for the session %s",
+ self.session)
+ ret, _, _ = gfind_post(self.mnode, self.volname, self.session)
+ self.assertEqual(ret, 0, ("Failed to perform glusterfind post"))
+ g.log.info("Successfully performed glusterfind post")
+
+ # Perform glusterfind pre using the invalid values for required
+ # parameters
+ not_volume = 'invalid-volume-name'
+ not_session = 'invalid-session-name'
+ not_outfile = '/tmp/not'
+ g.log.info("Performing glusterfind pre with invalid values for the "
+ "required parameters")
+ ret, _, _ = gfind_pre(self.mnode, not_volume, not_session, not_outfile)
+ self.assertNotEqual(ret, 0, "Unexpected: glusterfind pre Successful "
+ "even with invalid values for required parameters")
+ g.log.info("Successful: glusterfind pre failed with invalid values "
+ "for required parameters")
+
+ # Perform glusterfind pre using the invalid values for optional
+ # parameters
+ g.log.info("Deleting the session with invalid values for the optional "
+ "parameters")
+ invalid_options = [' --dbug', ' --noencod', ' --regenout', ' --type n',
+ ' --tagforfullfind', ' --disablepartial', ' --fll'
+ ' --outprefix none', ' --namespc']
+ for opt in invalid_options:
+ ret, _, _ = g.run(self.mnode, ("glusterfind pre %s %s %s %s"
+ % (self.volname, self.session,
+ self.outfile, opt)))
+ self.assertNotEqual(ret, 0, "Unexpected: glusterfind pre "
+ " successful for option %s which is invalid"
+ % opt)
+ g.log.info("Successful: glusterfind pre failed with invalid value "
+ "for optional parameters")
diff --git a/tests/functional/glusterfind/test_gfind_query_cli.py b/tests/functional/glusterfind/test_gfind_query_cli.py
new file mode 100644
index 000000000..ef9b431c2
--- /dev/null
+++ b/tests/functional/glusterfind/test_gfind_query_cli.py
@@ -0,0 +1,164 @@
+# Copyright (C) 2019 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
+# the Free Software Foundation; either version 2 of the License, or
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY :or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+from glusto.core import Glusto as g
+from glustolibs.gluster.exceptions import ExecutionError
+from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on
+from glustolibs.gluster.glusterfind_ops import gfind_query
+from glustolibs.gluster.glusterfile import (file_exists, remove_file,
+ check_if_pattern_in_file)
+
+
+@runs_on([['replicated', 'distributed-replicated', 'dispersed',
+ 'distributed', 'distributed-dispersed'],
+ ['glusterfs']])
+class TestGlusterFindQueryCLI(GlusterBaseClass):
+ """
+ GlusterFindQueryCLI contains tests which verifies the glusterfind query
+ command functionality.
+ """
+
+ def setUp(self):
+ """
+ setup volume and mount volume
+ Initiate necessary variables
+ """
+
+ # calling GlusterBaseClass setUp
+ self.get_super_method(self, 'setUp')()
+
+ # Setup Volume and Mount Volume
+ g.log.info("Starting to Setup %s", self.volname)
+ ret = self.setup_volume_and_mount_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Setup_Volume %s" % self.volname)
+ g.log.info("Successful in Setup Volume %s", self.volname)
+ self.outfile = '/tmp/test-outfile-%s.txt' % self.volname
+
+ def tearDown(self):
+ """
+ tearDown for every test and Clean up and unmount the volume
+ """
+
+ g.log.info("Removing the outfile created during 'glusterfind pre'")
+ ret = remove_file(self.mnode, self.outfile, force=True)
+ if not ret:
+ raise ExecutionError("Failed to remove the outfile")
+ g.log.info("Successfully removed the outfile")
+
+ # stopping the volume
+ g.log.info("Starting to Cleanup Volume")
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Cleanup Volume")
+ g.log.info("Successful in Cleanup Volume")
+
+ # calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
+
+ def test_gfind_query_cli(self):
+ """
+ Verifying the glusterfind query command functionality with valid
+ and invalid values for the required and optional parameters.
+
+ * Create a volume
+ * Perform some I/O from the mount point
+ * Perform glusterfind query with the following combinations:
+ - Valid values for required parameters
+ - Invalid values for required parameters
+ - Valid values for optional parameters
+ - Invalid values for optional parameters
+
+ Where
+ Required parameters: volname and sessname
+ Optional parameters: debug
+ """
+
+ # pylint: disable=too-many-statements
+ # Starting IO on the mounts
+ mount_obj = self.mounts[0]
+ mount_dir = mount_obj.mountpoint
+ client = mount_obj.client_system
+
+ g.log.info("Creating Files on %s:%s", client, mount_dir)
+ cmd = ("cd %s ; for i in `seq 1 10` ; "
+ "do dd if=/dev/urandom of=file$i bs=1M count=1 ; "
+ "done" % mount_dir)
+ ret, _, _ = g.run(client, cmd)
+ self.assertEqual(ret, 0, "Failed to create files on mountpoint")
+ g.log.info("Files created successfully on mountpoint")
+
+ # Check if the files exist
+ g.log.info("Checking the existence of files created during IO")
+ for i in range(1, 11):
+ ret = file_exists(client, '%s/file%s' % (mount_dir, i))
+ self.assertTrue(ret, "Unexpected: File 'file%s' does not exist"
+ % i)
+ g.log.info("Successfully validated existence of 'file%s'", i)
+
+ # Perform glusterfind query for the volume
+ g.log.info("Performing glusterfind query using valid values for the "
+ "required parameters")
+ ret, _, _ = gfind_query(self.mnode, self.volname, self.outfile,
+ full=True)
+ self.assertEqual(ret, 0, "Failed to perform glusterfind query")
+ g.log.info("Successfully performed glusterfind query")
+
+ # Check if the outfile exists
+ g.log.info("Checking if outfile created during glusterfind query "
+ "command exists")
+ ret = file_exists(self.mnode, self.outfile)
+ self.assertTrue(ret, "Unexpected: File '%s' does not exist"
+ % self.outfile)
+ g.log.info("Successfully validated existence of '%s'", self.outfile)
+
+ # Check if all the files are listed in the outfile
+ for i in range(1, 11):
+ ret = check_if_pattern_in_file(self.mnode,
+ 'file%s' % i, self.outfile)
+ self.assertEqual(ret, 0,
+ ("File 'file%s' not listed in %s"
+ % (i, self.outfile)))
+ g.log.info("File 'file%s' listed in %s", i, self.outfile)
+
+ # Perform glusterfind query using the invalid values for required
+ # parameters
+ not_volume = 'invalid-volume-name-for-glusterfind-query'
+ g.log.info("Performing glusterfind query using invalid values for "
+ "required parameters")
+ ret, _, _ = gfind_query(self.mnode, not_volume, self.outfile,
+ since='none')
+ self.assertNotEqual(ret, 0, "Unexpected: glusterfind query Successful "
+ "even with invalid values for required parameters")
+ g.log.info("Successful: glusterfind query failed with invalid values "
+ "for required parameters")
+
+ # Perform glusterfind query using the invalid values for optional
+ # parameters
+ g.log.info("Performing glusterfind query using invalid values for the "
+ "optional parameters")
+ invalid_options = [' --dbug', ' --noencod', ' --type n', ' --fll',
+ ' --tagforfullfind', ' --disablepartial',
+ ' --outprefix none', ' --namespc']
+ for opt in invalid_options:
+ ret, _, _ = g.run(self.mnode, ("glusterfind query %s %s %s"
+ % (self.volname, self.outfile,
+ opt)))
+ self.assertNotEqual(ret, 0, "Unexpected: glusterfind query "
+ " Successful for option %s which is invalid"
+ % opt)
+ g.log.info("Successful: glusterfind query failed with invalid value "
+ "for optional parameters")
diff --git a/tests/functional/glusterfind/test_gfind_rename.py b/tests/functional/glusterfind/test_gfind_rename.py
new file mode 100644
index 000000000..88e526155
--- /dev/null
+++ b/tests/functional/glusterfind/test_gfind_rename.py
@@ -0,0 +1,231 @@
+# Copyright (C) 2019 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
+# the Free Software Foundation; either version 2 of the License, or
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY :or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+from time import sleep
+from glusto.core import Glusto as g
+from glustolibs.gluster.exceptions import ExecutionError
+from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on
+from glustolibs.gluster.volume_ops import set_volume_options, volume_reset
+from glustolibs.gluster.glusterfind_ops import (gfind_create,
+ gfind_list,
+ gfind_pre,
+ gfind_post,
+ gfind_delete)
+from glustolibs.gluster.glusterfile import (file_exists, move_file,
+ check_if_pattern_in_file,
+ remove_file)
+
+
+@runs_on([['replicated', 'distributed-replicated', 'dispersed',
+ 'distributed', 'distributed-dispersed'],
+ ['glusterfs']])
+class TestGlusterFindRenames(GlusterBaseClass):
+ """
+ TestGlusterFindRenames contains tests which verifies the
+ glusterfind functionality with renames of files.
+ """
+
+ def setUp(self):
+ """
+ setup volume and mount volume
+ Initiate necessary variables
+ """
+
+ # calling GlusterBaseClass setUp
+ self.get_super_method(self, 'setUp')()
+
+ # Setup Volume and Mount Volume
+ g.log.info("Starting to Setup %s", self.volname)
+ ret = self.setup_volume_and_mount_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Setup_Volume %s" % self.volname)
+ g.log.info("Successful in Setup Volume %s", self.volname)
+ self.session = 'test-session-%s' % self.volname
+ self.outfiles = [('/tmp/test-outfile-%s-%s.txt'
+ % (self.volname, i))for i in range(0, 2)]
+
+ # Set the changelog rollover-time to 1 second
+ g.log.info("Setting the changelog rollover-time to 1 second")
+ option = {'changelog.rollover-time': '1'}
+ ret = set_volume_options(self.mnode, self.volname, option)
+ if not ret:
+ raise ExecutionError("Failed to set the volume option %s for %s"
+ % (option, self.volname))
+ g.log.info("Successfully set the volume option for the volume %s",
+ self.volname)
+
+ def tearDown(self):
+ """
+ tearDown for every test
+ Clean up and unmount the volume
+ """
+
+ ret, _, _ = gfind_delete(self.mnode, self.volname, self.session)
+ if ret != 0:
+ raise ExecutionError("Failed to delete session %s" % self.session)
+ g.log.info("Successfully deleted session %s", self.session)
+
+ g.log.info("Removing the outfiles created during 'glusterfind pre'")
+ for out in self.outfiles:
+ ret = remove_file(self.mnode, out, force=True)
+ if not ret:
+ raise ExecutionError("Failed to remove the outfile %s" % out)
+ g.log.info("Successfully removed the outfiles")
+
+ # Reset the volume
+ g.log.info("Reset the volume")
+ ret, _, _ = volume_reset(self.mnode, self.volname)
+ if ret != 0:
+ raise ExecutionError("Failed to reset the volume %s"
+ % self.volname)
+ g.log.info("Successfully reset the volume %s", self.volname)
+
+ # Cleanup the volume
+ g.log.info("Starting to Cleanup Volume")
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Cleanup Volume")
+ g.log.info("Successful in Cleanup Volume")
+
+ # calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
+
+ def test_gfind_renames(self):
+ """
+ Verifying the glusterfind functionality with renames of files.
+
+ * Create a volume
+ * Create a session on the volume
+ * Create various files from mount point
+ * Perform glusterfind pre
+ * Perform glusterfind post
+ * Check the contents of outfile
+ * Rename the files created from mount point
+ * Perform glusterfind pre
+ * Perform glusterfind post
+ * Check the contents of outfile
+ Files renamed must be listed
+ """
+
+ # pylint: disable=too-many-statements
+ # Creating a session for the volume
+ g.log.info("Creating a session for the volume %s", self.volname)
+ ret, _, _ = gfind_create(self.mnode, self.volname, self.session)
+ self.assertEqual(ret, 0, ("Unexpected: Creation of a session for the "
+ "volume %s failed" % self.volname))
+ g.log.info("Successfully created a session for the volume %s",
+ self.volname)
+
+ # Perform glusterfind list to check if session exists
+ g.log.info("Performing glusterfind list to check if the session is "
+ "created")
+ ret, _, _ = gfind_list(self.mnode, volname=self.volname,
+ sessname=self.session)
+ self.assertEqual(ret, 0, "Failed to list the glusterfind session")
+ g.log.info("Successfully listed the glusterfind session")
+
+ # Starting IO on the mounts
+ g.log.info("Creating Files on %s:%s",
+ self.mounts[0].client_system, self.mounts[0].mountpoint)
+ cmd = ("cd %s ; for i in `seq 1 10` ; "
+ "do dd if=/dev/urandom of=file$i bs=1M count=1 ; "
+ "done" % self.mounts[0].mountpoint)
+ ret, _, _ = g.run(self.mounts[0].client_system, cmd)
+ self.assertEqual(ret, 0, "Failed to create files on mountpoint")
+ g.log.info("Files created successfully on mountpoint")
+
+ # Check if the files exist
+ g.log.info("Checking the existence of files created during IO")
+ for i in range(1, 11):
+ ret = file_exists(self.mounts[0].client_system,
+ '%s/file%s' % (self.mounts[0].mountpoint, i))
+ self.assertTrue(ret, "Unexpected: File 'file%s' does not exist"
+ % i)
+ g.log.info("Successfully validated existence of 'file%s'", i)
+
+ sleep(5)
+
+ # Perform glusterfind pre for the session
+ g.log.info("Performing glusterfind pre for the session %s",
+ self.session)
+ ret, _, _ = gfind_pre(self.mnode, self.volname, self.session,
+ self.outfiles[0], full=True, noencode=True,
+ debug=True)
+ self.assertEqual(ret, 0, ("Failed to perform glusterfind pre"))
+ g.log.info("Successfully performed glusterfind pre")
+
+ # Check if the outfile exists
+ g.log.info("Checking if outfile created during glusterfind pre command"
+ " exists")
+ ret = file_exists(self.mnode, self.outfiles[0])
+ self.assertTrue(ret, "Unexpected: File '%s' does not exist"
+ % self.outfiles[0])
+ g.log.info("Successfully validated existence of '%s'",
+ self.outfiles[0])
+
+ # Check if all the files are listed in the outfile
+ for i in range(1, 11):
+ ret = check_if_pattern_in_file(self.mnode, 'file%s' % i,
+ self.outfiles[0])
+ self.assertEqual(ret, 0, ("File 'file%s' not listed in %s"
+ % (i, self.outfiles[0])))
+ g.log.info("File 'file%s' listed in %s", i, self.outfiles[0])
+
+ # Perform glusterfind post for the session
+ g.log.info("Performing glusterfind post for the session %s",
+ self.session)
+ ret, _, _ = gfind_post(self.mnode, self.volname, self.session)
+ self.assertEqual(ret, 0, ("Failed to perform glusterfind post"))
+ g.log.info("Successfully performed glusterfind post")
+
+ # Rename the files created from mount point
+ g.log.info("Renaming the Files on %s:%s", self.mounts[0].client_system,
+ self.mounts[0].mountpoint)
+ for i in range(1, 11):
+ ret = move_file(self.mounts[0].client_system,
+ "%s/file%s" % (self.mounts[0].mountpoint, i),
+ "%s/renamed-file%s"
+ % (self.mounts[0].mountpoint, i))
+ self.assertTrue(ret, "Failed to rename file%s" % i)
+ g.log.info("Successfully renamed all the files")
+
+ sleep(5)
+
+ # Perform glusterfind pre for the session
+ g.log.info("Performing glusterfind pre for the session %s",
+ self.session)
+ ret, _, _ = gfind_pre(self.mnode, self.volname, self.session,
+ self.outfiles[1], debug=True)
+ self.assertEqual(ret, 0, ("Failed to perform glusterfind pre"))
+ g.log.info("Successfully performed glusterfind pre")
+
+ # Check if the outfile exists
+ g.log.info("Checking if outfile created during glusterfind pre command"
+ " exists")
+ ret = file_exists(self.mnode, self.outfiles[1])
+ self.assertTrue(ret, "Unexpected: File '%s' does not exist"
+ % self.outfiles[1])
+ g.log.info("Successfully validated existence of '%s'",
+ self.outfiles[1])
+
+ # Check if all the files are listed in the outfile
+ for i in range(1, 11):
+ pattern = 'RENAME file%s renamed-file%s' % (i, i)
+ ret = check_if_pattern_in_file(self.mnode, pattern,
+ self.outfiles[1])
+ self.assertEqual(ret, 0, ("File 'renamed-file%s' not listed in %s"
+ % (i, self.outfiles[1])))
+ g.log.info("File 'file%s' listed in %s", i, self.outfiles[1])
diff --git a/tests/functional/glusterfind/test_gfind_type_option.py b/tests/functional/glusterfind/test_gfind_type_option.py
new file mode 100644
index 000000000..98e808f69
--- /dev/null
+++ b/tests/functional/glusterfind/test_gfind_type_option.py
@@ -0,0 +1,175 @@
+# Copyright (C) 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
+# the Free Software Foundation; either version 2 of the License, or
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY :or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+from glusto.core import Glusto as g
+from glustolibs.gluster.exceptions import ExecutionError
+from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on
+from glustolibs.gluster.glusterfile import (
+ file_exists,
+ remove_file,
+ check_if_pattern_in_file)
+from glustolibs.gluster.glusterfind_ops import (
+ gfind_create,
+ gfind_list,
+ gfind_pre,
+ gfind_query,
+ gfind_delete)
+
+
+@runs_on([["replicated", "distributed-replicated", "dispersed",
+ "distributed", "distributed-dispersed", "arbiter",
+ "distributed-arbiter"], ["glusterfs"]])
+class TestGlusterfindTypeOption(GlusterBaseClass):
+ """
+ TestGlusterfindTypeOption contains tests which verifies the
+ glusterfind functionality with --full --type options.
+ """
+ def setUp(self):
+ """
+ setup volume and mount volume
+ Initiate necessary variables
+ """
+ # calling GlusterBaseClass setUp
+ self.get_super_method(self, 'setUp')()
+
+ # Setup Volume and Mount Volume
+ g.log.info("Starting to Setup %s", self.volname)
+ ret = self.setup_volume_and_mount_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Setup_Volume %s" % self.volname)
+ g.log.info("Successful in Setup Volume %s", self.volname)
+ self.session = "test-session-%s" % self.volname
+ self.outfile = "/tmp/test-outfile-%s.txt" % self.volname
+
+ def tearDown(self):
+ """
+ tearDown for every test
+ Clean up and unmount the volume
+ """
+ # calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
+
+ # Delete the glusterfind sessions
+ ret, _, _ = gfind_delete(self.mnode, self.volname, self.session)
+ if ret:
+ raise ExecutionError("Failed to delete session %s" % self.session)
+ g.log.info("Successfully deleted session %s", self.session)
+
+ # Remove the outfile created during 'glusterfind pre and query'
+ ret = remove_file(self.mnode, self.outfile, force=True)
+ if not ret:
+ raise ExecutionError("Failed to remove the outfile")
+ g.log.info("Successfully removed the outfile")
+
+ # Cleanup the volume
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Cleanup Volume")
+ g.log.info("Successful in Cleanup Volume")
+
+ def _check_contents_of_outfile(self, gftype):
+ """Check contents of outfile created by query and pre"""
+ if gftype == 'f':
+ content = self.list_of_files
+ elif gftype == 'd':
+ content = self.list_of_dirs
+ else:
+ content = self.list_of_files + self.list_of_dirs
+
+ # Check if outfile is created or not
+ ret = file_exists(self.mnode, self.outfile)
+ self.assertTrue(ret, "Unexpected: File '%s' does not exist"
+ % self.outfile)
+
+ for value in content:
+ ret = check_if_pattern_in_file(self.mnode, value, self.outfile)
+ self.assertEqual(ret, 0, "Entry for '%s' not listed in %s"
+ % (value, self.outfile))
+
+ def test_gfind_full_type(self):
+ """
+ Verifying the glusterfind --full functionality with --type f,
+ --type f and --type both
+
+ * Create a volume
+ * Create a session on the volume
+ * Create various files on mount point
+ * Create various directories on point
+ * Perform glusterfind pre with --full --type f --regenerate-outfile
+ * Check the contents of outfile
+ * Perform glusterfind pre with --full --type d --regenerate-outfile
+ * Check the contents of outfile
+ * Perform glusterfind pre with --full --type both --regenerate-outfile
+ * Check the contents of outfile
+ * Perform glusterfind query with --full --type f
+ * Check the contents of outfile
+ * Perform glusterfind query with --full --type d
+ * Check the contents of outfile
+ * Perform glusterfind query with --full --type both
+ * Check the contents of outfile
+ """
+
+ # Create some files and directories from the mount point
+ cmd = ("cd {}; mkdir dir;mkdir .hiddendir;touch file;touch .hiddenfile"
+ ";mknod blockfile b 1 5;mknod charfile b 1 5; mkfifo pipefile;"
+ "touch fileforhardlink;touch fileforsoftlink;"
+ "ln fileforhardlink hardlinkfile;ln -s fileforsoftlink "
+ "softlinkfile".format(self.mounts[0].mountpoint))
+ ret, _, _ = g.run(self.mounts[0].client_system, cmd)
+
+ # Create list of files and dir to be used for checking
+ self.list_of_files = ['file', '.hiddenfile', 'blockfile', 'charfile',
+ 'pipefile', 'fileforhardlink', 'fileforsoftlink',
+ 'hardlinkfile', 'softlinkfile']
+ self.list_of_dirs = ['dir', '.hiddendir']
+
+ self.assertEqual(ret, 0, "Failed to create files and dirs")
+ g.log.info("Files and Dirs created successfully on mountpoint")
+
+ # Create session for volume
+ ret, _, _ = gfind_create(self.mnode, self.volname, self.session)
+ self.assertEqual(ret, 0, ("Unexpected: Creation of a session for the"
+ " volume %s failed" % self.volname))
+ g.log.info("Successfully created a session for the volume %s",
+ self.volname)
+
+ # Perform glusterfind list to check if session exists
+ _, out, _ = gfind_list(self.mnode, volname=self.volname,
+ sessname=self.session)
+ self.assertNotEqual(out, "No sessions found.",
+ "Failed to list the glusterfind session")
+ g.log.info("Successfully listed the glusterfind session")
+
+ # Perform glusterfind full pre for the session with --type option
+ for gftype in ('f', 'd', 'both'):
+ ret, _, _ = gfind_pre(
+ self.mnode, self.volname, self.session, self.outfile,
+ full=True, gftype=gftype, regenoutfile=True)
+ self.assertEqual(ret, 0, "glusterfind pre command successful "
+ "with --type %s" % gftype)
+
+ # Check the contents of the outfile
+ self._check_contents_of_outfile(gftype)
+
+ # Perform glusterfind full query with the --type option
+ for gftype in ('f', 'd', 'both'):
+ ret, _, _ = gfind_query(self.mnode, self.volname, self.outfile,
+ full=True, gftype=gftype)
+ self.assertEqual(ret, 0, "glusterfind query command successful "
+ "with --type %s" % gftype)
+
+ # Check the contents of the outfile
+ self._check_contents_of_outfile(gftype)
diff --git a/tests/functional/glusterfind/test_glusterfind_when_brick_down.py b/tests/functional/glusterfind/test_glusterfind_when_brick_down.py
new file mode 100644
index 000000000..de1ebaf23
--- /dev/null
+++ b/tests/functional/glusterfind/test_glusterfind_when_brick_down.py
@@ -0,0 +1,219 @@
+# Copyright (C) 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
+# the Free Software Foundation; either version 2 of the License, or
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY :or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+"""
+Description:
+ Test Glusterfind when brick is down
+"""
+
+from random import choice
+from time import sleep
+from glusto.core import Glusto as g
+from glustolibs.gluster.exceptions import ExecutionError
+from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on
+from glustolibs.gluster.volume_ops import set_volume_options
+from glustolibs.gluster.peer_ops import wait_for_peers_to_connect
+from glustolibs.gluster.lib_utils import list_files
+from glustolibs.gluster.volume_libs import volume_start
+from glustolibs.gluster.glusterfile import (
+ file_exists,
+ remove_file,
+ check_if_pattern_in_file)
+from glustolibs.gluster.glusterfind_ops import (
+ gfind_create,
+ gfind_list,
+ gfind_pre,
+ gfind_post,
+ gfind_delete)
+from glustolibs.gluster.brick_libs import (
+ get_all_bricks,
+ bring_bricks_offline)
+
+
+@runs_on([["replicated", "distributed-replicated", "dispersed",
+ "distributed", "distributed-dispersed"],
+ ["glusterfs"]])
+class TestGlusterFindBrickDown(GlusterBaseClass):
+ """
+ Test glusterfind operation when a brick is down.
+ """
+
+ def setUp(self):
+ """
+ setup volume and mount volume
+ Initiate necessary variables
+ """
+
+ # calling GlusterBaseClass setUp
+ self.get_super_method(self, 'setUp')()
+
+ self.file_limit = 0
+
+ # Setup Volume and Mount Volume
+ ret = self.setup_volume_and_mount_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Setup_Volume %s" % self.volname)
+ g.log.info("Successful in Setup Volume %s", self.volname)
+ self.session = "test-session-%s" % self.volname
+ self.outfiles = [("/tmp/test-outfile-%s-%s.txt"
+ % (self.volname, i))for i in range(0, 2)]
+
+ # Set the changelog rollover-time to 1 second
+ # This needs to be done in order for glusterfind to keep checking
+ # for changes in the mount point
+ option = {'changelog.rollover-time': '1'}
+ ret = set_volume_options(self.mnode, self.volname, option)
+ if not ret:
+ raise ExecutionError("Failed to set the volume option %s for %s"
+ % (option, self.volname))
+ g.log.info("Successfully set the volume option for the volume %s",
+ self.volname)
+
+ def _perform_io_and_validate_presence_of_files(self):
+ """
+ Function to perform the IO and validate the presence of files.
+ """
+ self.file_limit += 10
+ # Starting IO on the mounts
+ cmd = ("cd %s ; touch file{%d..%d}" % (self.mounts[0].mountpoint,
+ self.file_limit-10,
+ self.file_limit))
+
+ ret, _, _ = g.run(self.mounts[0].client_system, cmd)
+ self.assertEqual(ret, 0, "Failed to create files on mountpoint")
+ g.log.info("Files created successfully on mountpoint")
+
+ # Gather the list of files from the mount point
+ files = list_files(self.mounts[0].client_system,
+ self.mounts[0].mountpoint)
+ self.assertIsNotNone(files, "Failed to get the list of files")
+ g.log.info("Successfully gathered the list of files from mount point")
+
+ # Check if the files exist
+ for filename in files:
+ ret = file_exists(self.mounts[0].client_system, filename)
+ self.assertTrue(ret, ("Unexpected: File '%s' does not exist"
+ % filename))
+ g.log.info("Successfully validated existence of '%s'", filename)
+
+ def _perform_glusterfind_pre_and_validate_outfile(self):
+ """
+ Function to perform glusterfind pre and validate outfile
+ """
+ # Perform glusterfind pre for the session
+ ret, _, _ = gfind_pre(self.mnode, self.volname, self.session,
+ self.outfiles[0], full=True, noencode=True,
+ debug=True)
+ self.assertEqual(ret, 0, ("Failed to perform glusterfind pre"))
+ g.log.info("Successfully performed glusterfind pre")
+
+ # Check if the outfile exists
+ ret = file_exists(self.mnode, self.outfiles[0])
+ self.assertTrue(ret, ("Unexpected: File '%s' does not exist"
+ % self.outfiles[0]))
+ g.log.info("Successfully validated existence of '%s'",
+ self.outfiles[0])
+
+ # Check if all the files are listed in the outfile
+ for i in range(1, self.file_limit+1):
+ ret = check_if_pattern_in_file(self.mnode, "file%s" % i,
+ self.outfiles[0])
+ self.assertEqual(ret, 0, ("File 'file%s' not listed in %s"
+ % (i, self.outfiles[0])))
+ g.log.info("File 'file%s' listed in %s", i, self.outfiles[0])
+
+ def test_gfind_when_brick_down(self):
+ """
+ Verifying the glusterfind functionality when a brick is down.
+
+ 1. Create a volume
+ 2. Create a session on the volume
+ 3. Create various files from mount point
+ 4. Bring down brick process on one of the node
+ 5. Perform glusterfind pre
+ 6. Perform glusterfind post
+ 7. Check the contents of outfile
+ """
+
+ # pylint: disable=too-many-statements
+ # Create a session for the volume
+ ret, _, _ = gfind_create(self.mnode, self.volname, self.session)
+ self.assertEqual(ret, 0, ("Unexpected: Creation of a session for the "
+ "volume %s failed" % self.volname))
+ g.log.info("Successfully created a session for the volume %s",
+ self.volname)
+
+ # Perform glusterfind list to check if session exists
+ _, out, _ = gfind_list(self.mnode, volname=self.volname,
+ sessname=self.session)
+ self.assertNotEqual(out, "No sessions found.",
+ "Failed to list the glusterfind session")
+ g.log.info("Successfully listed the glusterfind session")
+
+ self._perform_io_and_validate_presence_of_files()
+
+ # Wait for changelog to get updated
+ sleep(2)
+
+ # Bring one of the brick down.
+ brick_list = get_all_bricks(self.mnode, self.volname)
+ ret = bring_bricks_offline(self.volname, choice(brick_list))
+ self.assertTrue(ret, "Failed to bring down the brick.")
+ g.log.info("Succesfully brought down one brick.")
+
+ self._perform_glusterfind_pre_and_validate_outfile()
+
+ # Perform glusterfind post for the session
+ ret, _, _ = gfind_post(self.mnode, self.volname, self.session)
+ self.assertEqual(ret, 0, ("Failed to perform glusterfind post"))
+ g.log.info("Successfully performed glusterfind post")
+
+ # Bring the brick process up.
+ ret = volume_start(self.mnode, self.volname, force=True)
+ self.assertTrue(ret, "Failed to start the volume.")
+ g.log.info("Successfully started the volume.")
+
+ def tearDown(self):
+ """
+ tearDown for every test
+ Clean up and unmount the volume
+ """
+ # calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
+
+ # Delete the glusterfind sessions
+ ret, _, _ = gfind_delete(self.mnode, self.volname, self.session)
+ if ret:
+ raise ExecutionError("Failed to delete session %s" % self.session)
+ g.log.info("Successfully deleted session %s", self.session)
+
+ # Remove the outfiles created during 'glusterfind pre'
+ for out in self.outfiles:
+ ret = remove_file(self.mnode, out, force=True)
+ if not ret:
+ raise ExecutionError("Failed to remove the outfile %s" % out)
+ g.log.info("Successfully removed the outfiles")
+
+ # Wait for the peers to be connected.
+ ret = wait_for_peers_to_connect(self.mnode, self.servers, 100)
+ if not ret:
+ raise ExecutionError("Peers are not in connected state.")
+
+ # Cleanup the volume
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Cleanup Volume")
+ g.log.info("Successful in Cleanup Volume")
diff --git a/tests/functional/glusterfind/test_glusterfind_when_node_down.py b/tests/functional/glusterfind/test_glusterfind_when_node_down.py
new file mode 100644
index 000000000..1d8b2572a
--- /dev/null
+++ b/tests/functional/glusterfind/test_glusterfind_when_node_down.py
@@ -0,0 +1,280 @@
+# Copyright (C) 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
+# the Free Software Foundation; either version 2 of the License, or
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY :or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+"""
+Description:
+ Test Glusterfind when node is down
+"""
+
+from random import choice
+from time import sleep
+from glusto.core import Glusto as g
+from glustolibs.gluster.exceptions import ExecutionError
+from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on
+from glustolibs.gluster.volume_ops import set_volume_options
+from glustolibs.gluster.peer_ops import wait_for_peers_to_connect
+from glustolibs.gluster.lib_utils import list_files
+from glustolibs.gluster.glusterfile import (
+ file_exists,
+ remove_file,
+ check_if_pattern_in_file)
+from glustolibs.gluster.glusterfind_ops import (
+ gfind_create,
+ gfind_list,
+ gfind_pre,
+ gfind_post,
+ gfind_delete)
+from glustolibs.gluster.gluster_init import (
+ stop_glusterd,
+ start_glusterd,
+ wait_for_glusterd_to_start)
+from glustolibs.misc.misc_libs import (
+ reboot_nodes,
+ are_nodes_online)
+
+
+@runs_on([["replicated", "distributed-replicated", "dispersed",
+ "distributed", "distributed-dispersed"],
+ ["glusterfs"]])
+class TestGlusterFindNodeDown(GlusterBaseClass):
+ """
+ Test glusterfind operation when a node is down.
+ """
+
+ def setUp(self):
+ """
+ setup volume and mount volume
+ Initiate necessary variables
+ """
+
+ # calling GlusterBaseClass setUp
+ self.get_super_method(self, 'setUp')()
+
+ self.file_limit = 0
+
+ # Setup Volume and Mount Volume
+ ret = self.setup_volume_and_mount_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Setup_Volume %s" % self.volname)
+ g.log.info("Successful in Setup Volume %s", self.volname)
+ self.session = "test-session-%s" % self.volname
+ self.outfiles = [("/tmp/test-outfile-%s-%s.txt"
+ % (self.volname, i))for i in range(0, 2)]
+
+ # Set the changelog rollover-time to 1 second
+ # This needs to be done in order for glusterfind to keep checking
+ # for changes in the mount point
+ option = {'changelog.rollover-time': '1'}
+ ret = set_volume_options(self.mnode, self.volname, option)
+ if not ret:
+ raise ExecutionError("Failed to set the volume option %s for %s"
+ % (option, self.volname))
+ g.log.info("Successfully set the volume option for the volume %s",
+ self.volname)
+
+ def _perform_io_and_validate_presence_of_files(self):
+ """
+ Function to perform the IO and validate the presence of files.
+ """
+ self.file_limit += 10
+ # Starting IO on the mounts
+ cmd = ("cd %s ; touch file{%d..%d}" % (self.mounts[0].mountpoint,
+ self.file_limit-10,
+ self.file_limit))
+
+ ret, _, _ = g.run(self.mounts[0].client_system, cmd)
+ self.assertEqual(ret, 0, "Failed to create files on mountpoint")
+ g.log.info("Files created successfully on mountpoint")
+
+ # Gather the list of files from the mount point
+ files = list_files(self.mounts[0].client_system,
+ self.mounts[0].mountpoint)
+ self.assertIsNotNone(files, "Failed to get the list of files")
+ g.log.info("Successfully gathered the list of files from mount point")
+
+ # Check if the files exist
+ for filename in files:
+ ret = file_exists(self.mounts[0].client_system, filename)
+ self.assertTrue(ret, ("Unexpected: File '%s' does not exist"
+ % filename))
+ g.log.info("Successfully validated existence of '%s'", filename)
+
+ def _perform_glusterfind_pre_and_validate_outfile(self):
+ """
+ Function to perform glusterfind pre and validate outfile
+ """
+ # Perform glusterfind pre for the session
+ ret, _, _ = gfind_pre(self.mnode, self.volname, self.session,
+ self.outfiles[0], full=True, noencode=True,
+ debug=True)
+ self.assertEqual(ret, 0, ("Failed to perform glusterfind pre"))
+ g.log.info("Successfully performed glusterfind pre")
+
+ # Check if the outfile exists
+ ret = file_exists(self.mnode, self.outfiles[0])
+ self.assertTrue(ret, ("Unexpected: File '%s' does not exist"
+ % self.outfiles[0]))
+ g.log.info("Successfully validated existence of '%s'",
+ self.outfiles[0])
+
+ # Check if all the files are listed in the outfile
+ for i in range(1, self.file_limit+1):
+ ret = check_if_pattern_in_file(self.mnode, "file%s" % i,
+ self.outfiles[0])
+ self.assertEqual(ret, 0, ("File 'file%s' not listed in %s"
+ % (i, self.outfiles[0])))
+ g.log.info("File 'file%s' listed in %s", i, self.outfiles[0])
+
+ def test_gfind_when_node_down(self):
+ """
+ Verifying the glusterfind functionality when node is down.
+
+ 1. Create a volume
+ 2. Create a session on the volume
+ 3. Create various files from mount point
+ 4. Bring down glusterd on one of the node
+ 5. Perform glusterfind pre
+ 6. Perform glusterfind post
+ 7. Check the contents of outfile
+ 8. Create more files from mountpoint
+ 9. Reboot one of the nodes
+ 10. Perform gluserfind pre
+ 11. Perform glusterfind post
+ 12. Check the contents of outfile
+ """
+
+ # pylint: disable=too-many-statements
+ # Create a session for the volume
+ ret, _, _ = gfind_create(self.mnode, self.volname, self.session)
+ self.assertEqual(ret, 0, ("Unexpected: Creation of a session for the "
+ "volume %s failed" % self.volname))
+ g.log.info("Successfully created a session for the volume %s",
+ self.volname)
+
+ # Perform glusterfind list to check if session exists
+ _, out, _ = gfind_list(self.mnode, volname=self.volname,
+ sessname=self.session)
+ self.assertNotEqual(out, "No sessions found.",
+ "Failed to list the glusterfind session")
+ g.log.info("Successfully listed the glusterfind session")
+
+ self._perform_io_and_validate_presence_of_files()
+
+ # Wait for changelog to get updated
+ sleep(2)
+
+ # Bring one of the node down.
+ self.random_server = choice(self.servers[1:])
+ ret = stop_glusterd(self.random_server)
+ self.assertTrue(ret, "Failed to stop glusterd on one node.")
+ g.log.info("Succesfully stopped glusterd on one node.")
+
+ self._perform_glusterfind_pre_and_validate_outfile()
+
+ # Perform glusterfind post for the session
+ ret, _, _ = gfind_post(self.mnode, self.volname, self.session)
+ self.assertEqual(ret, 0, ("Failed to perform glusterfind post"))
+ g.log.info("Successfully performed glusterfind post")
+
+ # Bring glusterd which was downed on a random node, up.
+ ret = start_glusterd(self.random_server)
+ self.assertTrue(ret, "Failed to start glusterd on %s"
+ % self.random_server)
+ g.log.info("Successfully started glusterd on node : %s",
+ self.random_server)
+
+ # Waiting for glusterd to start completely.
+ ret = wait_for_glusterd_to_start(self.random_server)
+ self.assertTrue(ret, "glusterd is not running on %s"
+ % self.random_server)
+ g.log.info("glusterd is started and running on %s",
+ self.random_server)
+
+ self._perform_io_and_validate_presence_of_files()
+
+ # Perform IO
+ self._perform_io_and_validate_presence_of_files()
+
+ # Wait for changelog to get updated
+ sleep(2)
+
+ # Reboot one of the nodes.
+ self.random_server = choice(self.servers[1:])
+ ret = reboot_nodes(self.random_server)
+ self.assertTrue(ret, "Failed to reboot the said node.")
+ g.log.info("Successfully started reboot process on one node.")
+
+ self._perform_glusterfind_pre_and_validate_outfile()
+
+ # Perform glusterfind post for the session
+ ret, _, _ = gfind_post(self.mnode, self.volname, self.session)
+ self.assertEqual(ret, 0, ("Failed to perform glusterfind post"))
+ g.log.info("Successfully performed glusterfind post")
+
+ # Gradual sleep backoff till the node has rebooted.
+ counter = 0
+ timeout = 300
+ ret = False
+ while counter < timeout:
+ ret, _ = are_nodes_online(self.random_server)
+ if not ret:
+ g.log.info("Node's offline, Retrying after 5 seconds ...")
+ sleep(5)
+ counter += 5
+ else:
+ ret = True
+ break
+ self.assertTrue(ret, "Node is still offline.")
+ g.log.info("Rebooted node is online")
+
+ # Wait for glusterd to start completely
+ ret = wait_for_glusterd_to_start(self.random_server)
+ self.assertTrue(ret, "glusterd is not running on %s"
+ % self.random_server)
+ g.log.info("glusterd is started and running on %s",
+ self.random_server)
+
+ def tearDown(self):
+ """
+ tearDown for every test
+ Clean up and unmount the volume
+ """
+ # calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
+
+ # Delete the glusterfind sessions
+ ret, _, _ = gfind_delete(self.mnode, self.volname, self.session)
+ if ret:
+ raise ExecutionError("Failed to delete session %s" % self.session)
+ g.log.info("Successfully deleted session %s", self.session)
+
+ # Remove the outfiles created during 'glusterfind pre'
+ for out in self.outfiles:
+ ret = remove_file(self.mnode, out, force=True)
+ if not ret:
+ raise ExecutionError("Failed to remove the outfile %s" % out)
+ g.log.info("Successfully removed the outfiles")
+
+ # Wait for the peers to be connected.
+ ret = wait_for_peers_to_connect(self.mnode, self.servers, 100)
+ if not ret:
+ raise ExecutionError("Peers are not in connected state.")
+
+ # Cleanup the volume
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Cleanup Volume")
+ g.log.info("Successful in Cleanup Volume")