summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkshithijiyer <kshithij.ki@gmail.com>2020-06-09 17:17:42 +0530
committerBala Konda Reddy M <bala12352@gmail.com>2020-06-10 08:51:04 +0000
commit9761f6fcf53237a6f107b53c4fde26efb32787b6 (patch)
tree553f974cbd7c154e6362376c0ecde15b86856b1f
parentf60a12bda34d206c1dca509a3a44d26a85f87239 (diff)
[Test] Add tc to check max-bricks-per-process
Test Case: - Create a gluster cluster - With brick mux set to disable: 1.Set cluster.max-bricks-per-process to int and check error message(Must fail) 2.Set cluster.max-bricks-per-process to string(Must fail) - With brick mux set to enable: 1.Set cluster.max-bricks-per-process to string(Must fail) 2.Set cluster.max-bricks-per-process to 0 3.Set cluster.max-bricks-per-process to 1 and check error message.(Must fail) 4.Set cluster.max-bricks-per-process to int value > 1. Also fixing small issues observed when running all the tests in the file. Change-Id: Iad27cd5bbeccc2bd2f0a7e510f881b0ffcb0d3b6 Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
-rwxr-xr-xtests/functional/multiplex/test_enabling_brick_mux.py101
1 files changed, 98 insertions, 3 deletions
diff --git a/tests/functional/multiplex/test_enabling_brick_mux.py b/tests/functional/multiplex/test_enabling_brick_mux.py
index ebdde0693..395de3b25 100755
--- a/tests/functional/multiplex/test_enabling_brick_mux.py
+++ b/tests/functional/multiplex/test_enabling_brick_mux.py
@@ -21,9 +21,11 @@ from glustolibs.gluster.gluster_base_class import (GlusterBaseClass, runs_on)
from glustolibs.gluster.exceptions import ExecutionError
from glustolibs.gluster.brickmux_ops import (disable_brick_mux,
is_brick_mux_enabled,
- get_brick_mux_status)
+ get_brick_mux_status,
+ enable_brick_mux)
from glustolibs.gluster.lib_utils import search_pattern_in_file
-from glustolibs.gluster.volume_ops import set_volume_options
+from glustolibs.gluster.volume_ops import (set_volume_options,
+ reset_volume_option)
@runs_on([['replicated'],
@@ -41,6 +43,11 @@ class TestBrickMultiplexing(GlusterBaseClass):
raise ExecutionError("Failed to disable brick multiplexing")
g.log.info("Disabled brick multiplexing successfully")
+ ret, _, _ = reset_volume_option(self.mnode, "all", "all")
+ if ret:
+ raise ExecutionError("Unable to reset all volume options")
+ g.log.info("Successfully reset all the volume options.")
+
# Calling GlusterBaseClass teardown
self.get_super_method(self, 'tearDown')()
@@ -150,8 +157,96 @@ class TestBrickMultiplexing(GlusterBaseClass):
temp_val = self.get_random_string(char_type)
value = "{}".format(temp_val)
- ret = set_volume_options(self.mnode, self.volname, {key: value})
+ ret = set_volume_options(self.mnode, 'all', {key: value})
self.assertFalse(ret, "Unexpected: Erroneous value {}, to option "
"{} should result in failure".format(value, key))
g.log.info("Expected: Erroneous value %s, to option "
"%s resulted in failure", value, key)
+
+ def set_max_brick_process_to_string(self):
+ """Set cluster.max-bricks-per-process to string"""
+ key = 'cluster.max-bricks-per-process'
+ for char_type in (string.ascii_letters, string.punctuation):
+
+ temp_val = self.get_random_string(char_type)
+ value = "{}".format(temp_val)
+ ret = set_volume_options(self.mnode, 'all', {key: value})
+ self.assertFalse(ret, "Unexpected: Erroneous value {}, to option "
+ "{} should result in failure".format(value, key))
+ g.log.info("Expected: Erroneous value %s, to option "
+ "%s resulted in failure", value, key)
+
+ def test_enable_brick_mux_with_max_bricks_per_process(self):
+ """
+ Test Case:
+ - Create a gluster cluster
+ - With brick mux set to disable:
+ 1.Set cluster.max-bricks-per-process to int and check
+ error message(Must fail)
+ 2.Set cluster.max-bricks-per-process to string(Must fail)
+ - With brick mux set to enable:
+ 1.Set cluster.max-bricks-per-process to string(Must fail)
+ 2.Set cluster.max-bricks-per-process to 0
+ 3.Set cluster.max-bricks-per-process to 1 and check
+ error message.(Must fail)
+ 4.Set cluster.max-bricks-per-process to int value > 1.
+ """
+ # Disabling cluster.brick-multiplex if not.
+ if is_brick_mux_enabled(self.mnode):
+ ret = disable_brick_mux(self.mnode)
+ self.assertTrue(ret, "Unable to disable brickmux")
+ g.log.info("Brick mux is disabled")
+
+ # Set cluster.max-bricks-per-process to int and check
+ # error message(Must fail)
+ cmd = "gluster v set all cluster.max-bricks-per-process 10"
+ ret, _, err = g.run(self.mnode, cmd)
+ self.assertEqual(ret, 1, 'Able to set max-bricks-per-process'
+ 'without enabling brick mux')
+ self.assertIn(
+ "volume set: failed: Brick-multiplexing is not enabled. "
+ "Please enable brick multiplexing before"
+ " trying to set this option.", err,
+ "Error message not proper on trying to "
+ "set max-bricks-per-process without brickmux")
+
+ # Set cluster.max-bricks-per-process to string(Must fail)
+ self.set_max_brick_process_to_string()
+
+ # Enable cluster.brick-multiplex.
+ ret = enable_brick_mux(self.mnode)
+ self.assertTrue(ret, "Unable to enable cluster.brick-multiplex")
+ g.log.info("Brick mux is enabled")
+
+ # Set cluster.max-bricks-per-process to string(Must fail)
+ self.set_max_brick_process_to_string()
+
+ # Set cluster.max-bricks-per-process to 0.
+ ret = set_volume_options(self.mnode, 'all',
+ {'cluster.max-bricks-per-process': '0'})
+ self.assertTrue(ret, "Unable to set "
+ "cluster.max-bricks-per-process to 0")
+ g.log.info("Successfully set cluster.max-bricks-per-process to 0")
+
+ # Set cluster.max-bricks-per-process to 1 and check
+ # error message.(Must fail)
+ cmd = "gluster v set all cluster.max-bricks-per-process 1"
+ ret, _, err = g.run(self.mnode, cmd)
+ self.assertEqual(ret, 1, 'Able to set max-bricks-per-process'
+ 'with enabling brick mux')
+ self.assertIn(
+ "volume set: failed: Brick-multiplexing is enabled."
+ " Please set this option to a value other than 1 to"
+ " make use of the brick-multiplexing feature.", err,
+ "Error message not proper on trying to set max-bricks-per-process"
+ " with brickmux")
+
+ # Set cluster.max-bricks-per-process to int value > 1
+ key = 'cluster.max-bricks-per-process'
+ temp_val = self.get_random_string(string.digits)
+ value = "{}".format(temp_val)
+ ret = set_volume_options(self.mnode, 'all',
+ {key: value})
+ self.assertTrue(ret, "Unexpected: Erroneous value {}, to option "
+ "{} should not result in failure".format(value, key))
+ g.log.info("Value %s, set to option %s", value, key)