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