summaryrefslogtreecommitdiffstats
path: root/tests/functional/afr
diff options
context:
space:
mode:
authorBala Konda Reddy M <bala12352@gmail.com>2020-06-09 22:00:50 +0530
committerBala Konda Reddy M <bala12352@gmail.com>2020-06-16 10:37:52 +0000
commit108d92eaeef8c34231248eb68cddb4dab1a7b9da (patch)
treef429400562f24f17e1df8399c33c38780f0bfbbd /tests/functional/afr
parent233d7b1a5755f434dcfb801e17b894844b7182cc (diff)
[Test] Git clone on glusterfs volume
Test Steps: 1. Create a volume and mount it on one client 2. git clone the glusterfs repo on the glusterfs volume 3. Set the performance options to off 4. Repeat step 2 on a different directory Change-Id: Iaecce7cd14ecf84058c75847a037c6589d3833e9 Signed-off-by: Bala Konda Reddy M <bala12352@gmail.com>
Diffstat (limited to 'tests/functional/afr')
-rw-r--r--tests/functional/afr/test_git_clone.py80
1 files changed, 80 insertions, 0 deletions
diff --git a/tests/functional/afr/test_git_clone.py b/tests/functional/afr/test_git_clone.py
new file mode 100644
index 000000000..02871cb8b
--- /dev/null
+++ b/tests/functional/afr/test_git_clone.py
@@ -0,0 +1,80 @@
+# 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.misc.misc_libs import git_clone_and_compile
+from glustolibs.gluster.volume_ops import set_volume_options
+
+
+@runs_on([['replicated', 'distributed-replicated', 'dispersed',
+ 'distributed-dispersed', 'arbiter', 'distributed-arbiter'],
+ ['glusterfs']])
+class TestGitCloneOnGlusterVolume(GlusterBaseClass):
+
+ def setUp(self):
+ self.get_super_method(self, 'setUp')()
+
+ # Setup volume and mount it on one client
+ if not self.setup_volume_and_mount_volume([self.mounts[0]]):
+ raise ExecutionError("Failed to Setup_Volume and Mount_Volume")
+ g.log.info("Successful in Setup Volume and Mount Volume")
+
+ def tearDown(self):
+ self.get_super_method(self, 'tearDown')()
+
+ # Unmount from the one client and cleanup the volume
+ if not self.unmount_volume_and_cleanup_volume([self.mounts[0]]):
+ raise ExecutionError("Unable to unmount and cleanup volume")
+ g.log.info("Unmount and volume cleanup is successful")
+
+ def _run_git_clone(self, options):
+ """Run git clone on the client"""
+
+ repo = 'https://github.com/gluster/glusterfs.git'
+ cloned_repo_dir = (self.mounts[0].mountpoint + '/' +
+ repo.split('/')[-1].rstrip('.git'))
+ if options:
+ cloned_repo_dir = (self.mounts[0].mountpoint + '/' + "perf-" +
+ repo.split('/')[-1].rstrip('.git'))
+ ret = git_clone_and_compile(self.mounts[0].client_system,
+ repo, cloned_repo_dir, False)
+ self.assertTrue(ret, "Unable to clone {} repo on {}".
+ format(repo, cloned_repo_dir))
+ g.log.info("Repo %s cloned successfully ", repo)
+
+ def test_git_clone_on_gluster_volume(self):
+ """
+ Test Steps:
+ 1. Create a volume and mount it on one client
+ 2. git clone the glusterfs repo on the glusterfs volume.
+ 3. Set the performance options to off
+ 4. Repeat step 2 on a different directory.
+ """
+ self._run_git_clone(False)
+
+ # Disable the performance cache options on the volume
+ self.options = {'performance.quick-read': 'off',
+ 'performance.stat-prefetch': 'off',
+ 'performance.open-behind': 'off',
+ 'performance.write-behind': 'off',
+ 'performance.client-io-threads': 'off'}
+ ret = set_volume_options(self.mnode, self.volname, self.options)
+ self.assertTrue(ret, "Unable to set the volume options")
+ g.log.info("Volume options set successfully")
+
+ self._run_git_clone(True)