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