summaryrefslogtreecommitdiffstats
path: root/tests/functional/dht
diff options
context:
space:
mode:
authorsayaleeraut <saraut@redhat.com>2019-08-30 12:05:43 +0530
committerBala Konda Reddy M <bala12352@gmail.com>2020-04-23 13:13:49 +0000
commit1a269464cced564d01503a4675db42212cefc9f8 (patch)
tree79a29590bb11bec71dbbf17f2f212f2823a12a02 /tests/functional/dht
parent91c5664b25c676d75637b27b8b850aea5decbf9c (diff)
[TestFix] Add code to override the volume config
Changing the distribute count to 4 for the volume type distributed-replicated or distributed-dispersed, as earlier with distribute count 2, after remove-brick, the dist-rep & dist-disp volumes were converted to pure rep or pure dispersed, which caused "layout not complete" error as with the DHT pass-through feature layout is not set on bricks if volume type is pure replicated/pure dispersed on gluster version 6.0 Adding distributed-arbiter volume type and have added code to override its configuration as well. Change-Id: Ic7a3404ed49d24f956de33f7bd5ca8ea61297e5b Signed-off-by: sayaleeraut <saraut@redhat.com>
Diffstat (limited to 'tests/functional/dht')
-rw-r--r--tests/functional/dht/test_induce_holes_in_layout_by_removebrick_force_then_lookup.py111
1 files changed, 73 insertions, 38 deletions
diff --git a/tests/functional/dht/test_induce_holes_in_layout_by_removebrick_force_then_lookup.py b/tests/functional/dht/test_induce_holes_in_layout_by_removebrick_force_then_lookup.py
index c4acb67c3..51465ea81 100644
--- a/tests/functional/dht/test_induce_holes_in_layout_by_removebrick_force_then_lookup.py
+++ b/tests/functional/dht/test_induce_holes_in_layout_by_removebrick_force_then_lookup.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2018 Red Hat, Inc. http://www.redhat.com>
+# Copyright (C) 2018-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
@@ -14,9 +14,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-import tempfile
from glusto.core import Glusto as g
-
from glustolibs.gluster.brick_ops import remove_brick
from glustolibs.gluster.constants import \
TEST_LAYOUT_IS_COMPLETE as LAYOUT_IS_COMPLETE
@@ -30,46 +28,72 @@ from glustolibs.gluster.dht_test_utils import is_layout_complete
from glustolibs.gluster.mount_ops import mount_volume
-@runs_on([['distributed', 'distributed-replicated', 'distributed-dispersed'],
+@runs_on([['distributed', 'distributed-replicated', 'distributed-arbiter',
+ 'distributed-dispersed'],
['glusterfs']])
class RebalanceValidation(GlusterBaseClass):
- def setUp(self):
-
- # Calling GlusterBaseClass setUp
- self.get_super_method(self, 'setUp')()
+ @classmethod
+ def setUpClass(cls):
+
+ # Calling GlusterBaseClass setUpClass
+ cls.get_super_method(cls, 'setUpClass')()
+
+ # Check for the default dist_count value and override it if required
+ if cls.default_volume_type_config['distributed']['dist_count'] <= 2:
+ cls.default_volume_type_config['distributed']['dist_count'] = 4
+ if (cls.default_volume_type_config['distributed-replicated']
+ ['dist_count']) <= 2:
+ (cls.default_volume_type_config['distributed-replicated']
+ ['dist_count']) = 4
+ if (cls.default_volume_type_config['distributed-dispersed']
+ ['dist_count']) <= 2:
+ (cls.default_volume_type_config['distributed-dispersed']
+ ['dist_count']) = 4
+ if (cls.default_volume_type_config['distributed-arbiter']
+ ['dist_count']) <= 2:
+ (cls.default_volume_type_config['distributed-arbiter']
+ ['dist_count']) = 4
# Setup Volume and Mount Volume
+
g.log.info("Starting to Setup Volume and Mount Volume")
- ret = self.setup_volume_and_mount_volume(mounts=self.mounts)
+ ret = cls.setup_volume_and_mount_volume(mounts=cls.mounts)
if not ret:
raise ExecutionError("Failed to Setup_Volume and Mount_Volume")
g.log.info("Successful in Setup Volume and Mount Volume")
- # Form bricks list for Shrinking volume
- self.remove_brick_list = form_bricks_list_to_remove_brick(self.mnode,
- self.volname,
- subvol_num=1)
- if not self.remove_brick_list:
- g.log.error("Volume %s: Failed to form bricks list "
- "for volume shrink", self.volname)
- raise ExecutionError("Volume %s: Failed to form bricks list "
- "for volume shrink" % self.volname)
- g.log.info("Volume %s: Formed bricks list for volume shrink",
- self.volname)
-
def test_induce_holes_then_lookup(self):
+ """
+ Test Script to induce holes in layout by using remove-brick force
+ and then performing lookup in order to fix the layout.
+
+ Steps :
+ 1) Create a volume and mount it using FUSE.
+ 2) Create a directory "testdir" on mount point.
+ 3) Check if the layout is complete.
+ 4) Log volume info and status before remove-brick operation.
+ 5) Form a list of bricks to be removed.
+ 6) Start remove-brick operation using 'force'.
+ 7) Let remove-brick complete and check layout.
+ 8) Mount the volume on a new mount.
+ 9) Send a lookup on mount point.
+ 10) Check if the layout is complete.
+
+ """
# pylint: disable=too-many-statements
+ # Create a directory on mount point
m_point = self.mounts[0].mountpoint
- command = 'mkdir -p ' + m_point + '/testdir'
+ dirpath = '/testdir'
+ command = 'mkdir -p ' + m_point + dirpath
ret, _, _ = g.run(self.clients[0], command)
self.assertEqual(ret, 0, "mkdir failed")
g.log.info("mkdir is successful")
# DHT Layout validation
g.log.debug("Verifying hash layout values %s:%s",
- self.clients[0], self.mounts[0].mountpoint)
- ret = validate_files_in_dir(self.clients[0], self.mounts[0].mountpoint,
+ self.clients[0], m_point)
+ ret = validate_files_in_dir(self.clients[0], m_point,
test_type=LAYOUT_IS_COMPLETE,
file_type=FILETYPE_DIRS)
self.assertTrue(ret, "LAYOUT_IS_COMPLETE: FAILED")
@@ -79,6 +103,16 @@ class RebalanceValidation(GlusterBaseClass):
g.log.info("Logging volume info and Status before shrinking volume")
log_volume_info_and_status(self.mnode, self.volname)
+ # Form bricks list for Shrinking volume
+ self.remove_brick_list = form_bricks_list_to_remove_brick(self.mnode,
+ self.volname,
+ subvol_num=1)
+ self.assertNotEqual(self.remove_brick_list, None,
+ ("Volume %s: Failed to form bricks list for volume"
+ " shrink", self.volname))
+ g.log.info("Volume %s: Formed bricks list for volume shrink",
+ self.volname)
+
# Shrinking volume by removing bricks
g.log.info("Start removing bricks from volume")
ret, _, _ = remove_brick(self.mnode, self.volname,
@@ -87,32 +121,33 @@ class RebalanceValidation(GlusterBaseClass):
g.log.info("Remove-brick with force: PASS")
# Check the layout
- dirpath = '/testdir'
ret = is_layout_complete(self.mnode, self.volname, dirpath)
- self.assertFalse(ret, "Volume %s: Layout is complete")
- g.log.info("Volume %s: Layout has some holes")
+ self.assertFalse(ret, ("Volume %s: Layout is complete", self.volname))
+ g.log.info("Volume %s: Layout has some holes", self.volname)
# Mount the volume on a new mount point
- mount_point = tempfile.mkdtemp()
ret, _, _ = mount_volume(self.volname, mtype='glusterfs',
- mpoint=mount_point,
+ mpoint=m_point,
mserver=self.mnode,
- mclient=self.mnode)
- self.assertEqual(ret, 0, ("Failed to do gluster mount on volume %s",
- self.volname))
- g.log.info("Volume %s: mount success", self.mnode)
+ mclient=self.clients[1])
+ self.assertEqual(ret, 0, ("Failed to do gluster mount of volume %s"
+ " on client node %s",
+ self.volname, self.clients[1]))
+ g.log.info("Volume %s mounted successfullly on %s", self.volname,
+ self.clients[1])
# Send a look up on the directory
- cmd = 'ls %s%s' % (mount_point, dirpath)
- ret, _, err = g.run(self.mnode, cmd)
+ cmd = 'ls %s%s' % (m_point, dirpath)
+ ret, _, err = g.run(self.clients[1], cmd)
self.assertEqual(ret, 0, ("Lookup failed on %s with error %s",
(dirpath, err)))
- g.log.info("Lookup sent successfully on %s", dirpath)
+ g.log.info("Lookup sent successfully on %s", m_point + dirpath)
# DHT Layout validation
+ g.log.info("Checking layout after new mount")
g.log.debug("Verifying hash layout values %s:%s",
- self.mnode, mount_point + dirpath)
- ret = validate_files_in_dir(self.mnode, mount_point + dirpath,
+ self.clients[1], m_point + dirpath)
+ ret = validate_files_in_dir(self.clients[1], m_point + dirpath,
test_type=LAYOUT_IS_COMPLETE,
file_type=FILETYPE_DIRS)
self.assertTrue(ret, "LAYOUT_IS_COMPLETE: FAILED")