summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkshithijiyer <kshithij.ki@gmail.com>2020-06-11 18:53:58 +0530
committerBala Konda Reddy M <bala12352@gmail.com>2020-06-19 08:51:51 +0000
commite6c9772bed8abd646d1e0610a8912e0e1d3dd10f (patch)
treebbc5998e1bf65a09b02c11ee2644ccc74bfc748c
parente3a59fb1fcf2cf6a78c8d6b7a2b377643c83bfe5 (diff)
[Test] Add tc to check eager lock cli
Testcase Steps: 1.Create an EC volume 2.Set the eager lock option by turning on disperse.eager-lock by using different inputs: - Try non boolean values(Must fail) - Try boolean values Change-Id: Iec875ce9fb4c8f7c68b012ede98bd94b82d04d7e Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
-rw-r--r--tests/functional/disperse/test_disperse_eager_lock.py71
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/functional/disperse/test_disperse_eager_lock.py b/tests/functional/disperse/test_disperse_eager_lock.py
new file mode 100644
index 0000000..7f7ee84
--- /dev/null
+++ b/tests/functional/disperse/test_disperse_eager_lock.py
@@ -0,0 +1,71 @@
+# 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 random import choice
+import string
+
+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
+
+
+@runs_on([['dispersed', 'distributed-dispersed'], ['glusterfs']])
+class TestDisperseEagerLock(GlusterBaseClass):
+ def setUp(self):
+ ret = self.setup_volume()
+ if not ret:
+ raise ExecutionError("Failed to Setup_Volume and Mount_Volume")
+
+ @staticmethod
+ def get_random_string(chars, str_len=4):
+ return ''.join((choice(chars) for _ in range(str_len)))
+
+ def test_disperse_eager_lock_cli(self):
+ """
+ Testcase Steps:
+ 1.Create an EC volume
+ 2.Set the eager lock option by turning
+ on disperse.eager-lock by using different inputs:
+ - Try non boolean values(Must fail)
+ - Try boolean values
+ """
+ # Set the eager lock option by turning
+ # on disperse.eager-lock by using different inputs
+ key = 'disperse.eager-lock'
+
+ # Set eager lock option with non-boolean value
+ for char_type in (string.ascii_letters, string.punctuation,
+ string.printable, string.digits):
+ temp_val = self.get_random_string(char_type)
+ value = "{}".format(temp_val)
+ ret = set_volume_options(self.mnode, self.volname, {key: value})
+ self.assertFalse(ret, "Unexpected: Erroneous value {}, to option "
+ "{} should result in failure".format(value, key))
+
+ # Set eager lock option with boolean value
+ for value in ('1', '0', 'off', 'on', 'disable', 'enable'):
+ ret = set_volume_options(self.mnode, self.volname, {key: value})
+ self.assertTrue(ret, "Unexpected: Boolean value {},"
+ " to option {} shouldn't result in failure"
+ .format(value, key))
+ g.log.info("Only Boolean values are accpeted by eager lock.")
+
+ def tearDown(self):
+ ret = self.cleanup_volume()
+ if not ret:
+ raise ExecutionError("Failed to Unmount Volume and Cleanup Volume")