14f8ab
From a0949929282529e0e866e074721c1bdfe3928c8c Mon Sep 17 00:00:00 2001
14f8ab
From: N Balachandran <nbalacha@redhat.com>
14f8ab
Date: Thu, 11 Apr 2019 12:12:12 +0530
14f8ab
Subject: [PATCH 131/141] tests/dht: Test that lookups are sent post brick up
14f8ab
14f8ab
upstream: https://review.gluster.org/#/c/glusterfs/+/22545/
14f8ab
14f8ab
>Change-Id: I3556793c5e9d58cc6a08644b41dc5740fab2610b
14f8ab
>updates: bz#1628194
14f8ab
14f8ab
BUG:1704562
14f8ab
Change-Id: Ie45331298902bd5268c56cb29a966d8246abfd6d
14f8ab
Signed-off-by: N Balachandran <nbalacha@redhat.com>
14f8ab
Reviewed-on: https://code.engineering.redhat.com/gerrit/169592
14f8ab
Tested-by: RHGS Build Bot <nigelb@redhat.com>
14f8ab
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
14f8ab
---
14f8ab
 tests/basic/distribute/brick-down.t | 83 +++++++++++++++++++++++++++++++++++++
14f8ab
 1 file changed, 83 insertions(+)
14f8ab
 create mode 100644 tests/basic/distribute/brick-down.t
14f8ab
14f8ab
diff --git a/tests/basic/distribute/brick-down.t b/tests/basic/distribute/brick-down.t
14f8ab
new file mode 100644
14f8ab
index 0000000..522ccc0
14f8ab
--- /dev/null
14f8ab
+++ b/tests/basic/distribute/brick-down.t
14f8ab
@@ -0,0 +1,83 @@
14f8ab
+#!/bin/bash
14f8ab
+
14f8ab
+. $(dirname $0)/../../include.rc
14f8ab
+. $(dirname $0)/../../volume.rc
14f8ab
+. $(dirname $0)/../../common-utils.rc
14f8ab
+. $(dirname $0)/../../dht.rc
14f8ab
+
14f8ab
+# Test 1 overview:
14f8ab
+# ----------------
14f8ab
+# Test whether lookups are sent after a brick comes up again
14f8ab
+#
14f8ab
+# 1. Create a 3 brick pure distribute volume
14f8ab
+# 2. Fuse mount the volume so the layout is set on the root
14f8ab
+# 3. Kill one brick and try to create a directory which hashes to that brick.
14f8ab
+#    It should fail with EIO.
14f8ab
+# 4. Restart the brick that was killed.
14f8ab
+# 5. Do not remount the volume. Try to create the same directory as in step 3.
14f8ab
+
14f8ab
+cleanup
14f8ab
+
14f8ab
+TEST glusterd
14f8ab
+TEST pidof glusterd
14f8ab
+
14f8ab
+TEST $CLI volume create $V0 $H0:$B0/$V0-{1..3}
14f8ab
+TEST $CLI volume start $V0
14f8ab
+
14f8ab
+# We want the lookup to reach DHT
14f8ab
+TEST $CLI volume set $V0 performance.stat-prefetch off
14f8ab
+
14f8ab
+# Mount using FUSE and lookup the mount so a layout is set on the brick root
14f8ab
+TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0
14f8ab
+
14f8ab
+ls $M0/
14f8ab
+
14f8ab
+TEST mkdir $M0/level1
14f8ab
+
14f8ab
+# Find a dirname that will hash to the brick we are going to kill
14f8ab
+hashed=$V0-client-1
14f8ab
+TEST dht_first_filename_with_hashsubvol "$hashed" $M0 "dir-"
14f8ab
+roottestdir=$fn_return_val
14f8ab
+
14f8ab
+hashed=$V0-client-1
14f8ab
+TEST dht_first_filename_with_hashsubvol "$hashed" $M0/level1 "dir-"
14f8ab
+level1testdir=$fn_return_val
14f8ab
+
14f8ab
+
14f8ab
+TEST kill_brick $V0 $H0 $B0/$V0-2
14f8ab
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" brick_up_status $V0 $H0 $B0/$V0-2
14f8ab
+
14f8ab
+TEST $CLI volume status $V0
14f8ab
+
14f8ab
+
14f8ab
+# Unmount and mount the volume again so dht has an incomplete in memory layout
14f8ab
+
14f8ab
+umount -f $M0
14f8ab
+TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0
14f8ab
+
14f8ab
+
14f8ab
+mkdir $M0/$roottestdir
14f8ab
+TEST [ $? -ne 0 ]
14f8ab
+
14f8ab
+mkdir $M0/level1/$level1testdir
14f8ab
+TEST [ $? -ne 0 ]
14f8ab
+
14f8ab
+TEST $CLI volume start $V0 force
14f8ab
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/$V0-2
14f8ab
+
14f8ab
+#$CLI volume status
14f8ab
+
14f8ab
+# It takes a while for the client to reconnect to the brick
14f8ab
+sleep 5
14f8ab
+
14f8ab
+
14f8ab
+mkdir $M0/$roottestdir
14f8ab
+TEST [ $? -eq 0 ]
14f8ab
+
14f8ab
+mkdir $M0/$level1/level1testdir
14f8ab
+TEST [ $? -eq 0 ]
14f8ab
+
14f8ab
+# Cleanup
14f8ab
+cleanup
14f8ab
+
14f8ab
+
14f8ab
-- 
14f8ab
1.8.3.1
14f8ab