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