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