tests: Wait for nfs export to be available

Change-Id: I59a5e0cb78f2b670761a65272b8ab1d7bdb3668a
BUG: 1092850
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/7773
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
This commit is contained in:
Pranith Kumar K 2014-05-15 14:40:16 +05:30 committed by Vijay Bellur
parent 07e8f0226d
commit 05a5ffe972
20 changed files with 78 additions and 63 deletions

View File

@ -17,7 +17,7 @@ TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $
EXPECT_WITHIN 20 "1" is_nfs_export_available;
## Mount volume as NFS export
TEST mount -t nfs -o vers=3,nolock $H0:/$V0 $N0;
TEST mount_nfs $H0:/$V0 $N0 nolock;
# just a random uid/gid
uid=22162

View File

@ -31,7 +31,7 @@ TEST $CLI volume start $V0
EXPECT_WITHIN 20 "1" is_nfs_export_available
# mount the volume
TEST mount -t nfs -o vers=3,nolock $H0:/$V0 $N0
TEST mount_nfs $H0:/$V0 $N0 nolock
TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0
# the actual test, this used to crash

View File

@ -2,6 +2,7 @@
. $(dirname $0)/../include.rc
. $(dirname $0)/../volume.rc
. $(dirname $0)/../nfs.rc
cleanup;
@ -21,7 +22,8 @@ EXPECT 'Created' volinfo_field $V0 'Status';
TEST $CLI volume start $V0;
EXPECT 'Started' volinfo_field $V0 'Status';
TEST mount -t nfs -o vers=3 $H0:/$V0 $N0;
EXPECT_WITHIN 20 "1" is_nfs_export_available;
TEST mount_nfs $H0:/$V0 $N0;
############################################################################
#TEST-PLAN:

View File

@ -14,6 +14,7 @@
. $(dirname $0)/../include.rc
. $(dirname $0)/../fileio.rc
. $(dirname $0)/../nfs.rc
cleanup;
@ -29,7 +30,8 @@ EXPECT 'Created' volinfo_field $V0 'Status';
TEST $CLI volume start $V0;
EXPECT 'Started' volinfo_field $V0 'Status';
TEST mount -t nfs -o noac,soft,nolock,vers=3 $H0:/$V0 $N0
EXPECT_WITHIN 20 "1" is_nfs_export_available;
TEST mount_nfs $H0:/$V0 $N0 noac,nolock
QUOTA_LIMIT_DIR="quota_limit_dir"

View File

@ -1,6 +1,7 @@
#!/bin/bash
. $(dirname $0)/../include.rc
. $(dirname $0)/../nfs.rc
cleanup;
@ -42,11 +43,9 @@ TEST $CLI volume start $V0;
EXPECT 'Started' volinfo_field $V0 'Status';
## Wait for volume to register with rpc.mountd
sleep 5;
EXPECT_WITHIN 20 "1" is_nfs_export_available;
## Mount NFS
TEST mount -t nfs -o vers=3,nolock,soft,intr $H0:/$V0 $N0;
TEST mount_nfs $H0:/$V0 $N0 nolock;
## Create some files and directories
echo "test_data" > $N0/a_file;
@ -70,8 +69,8 @@ setfattr -n trusted.glusterfs.volume-id -v $volid $B0/${V0}-0
## Restart and remount. Note that we use actimeo=0 so that the stat calls
## we need for self-heal don't get blocked by the NFS client.
TEST $CLI volume start $V0;
sleep 5
TEST mount -t nfs -o vers=3,nolock,soft,intr,actimeo=0 $H0:/$V0 $N0;
EXPECT_WITHIN 20 "1" is_nfs_export_available;
TEST mount_nfs $H0:/$V0 $N0 nolock,actimeo=0;
## The Linux NFS client has a really charming habit of caching stuff right
## after mount, even though we set actimeo=0 above. Life would be much easier

View File

@ -1,6 +1,7 @@
#!/bin/bash
. $(dirname $0)/../include.rc
. $(dirname $0)/../nfs.rc
cleanup;
@ -9,9 +10,8 @@ TEST pidof glusterd
TEST $CLI volume create $V0 $H0:$B0/brick0
TEST $CLI volume start $V0
sleep 5
TEST mount -t nfs -o vers=3,nolock $H0:/$V0 $N0
EXPECT_WITHIN 20 "1" is_nfs_export_available;
TEST mount_nfs $H0:/$V0 $N0 nolock
cd $N0
# simple getfacl setfacl commands

View File

@ -1,6 +1,7 @@
#!/bin/bash
. $(dirname $0)/../include.rc
. $(dirname $0)/../nfs.rc
cleanup
#1
@ -10,8 +11,8 @@ TEST pidof glusterd
TEST $CLI volume create $V0 $H0:$B0/$V0
TEST $CLI volume set $V0 nfs.drc on
TEST $CLI volume start $V0
sleep 5
TEST mount -t nfs -o vers=3,nolock,soft,intr $H0:/$V0 $N0
EXPECT_WITHIN 20 "1" is_nfs_export_available;
TEST mount_nfs $H0:/$V0 $N0 nolock
cd $N0
#7
TEST dbench -t 10 10

View File

@ -1,6 +1,7 @@
#!/bin/bash
. $(dirname $0)/../include.rc
. $(dirname $0)/../nfs.rc
cleanup;
@ -9,9 +10,8 @@ TEST pidof glusterd
TEST $CLI volume create $V0 $H0:$B0/brick0
TEST $CLI volume start $V0
sleep 5
TEST mount -t nfs -o vers=3,nolock $H0:/$V0 $N0
EXPECT_WITHIN 20 "1" is_nfs_export_available;
TEST mount_nfs $H0:/$V0 $N0 nolock
cd $N0
TEST ls

View File

@ -1,6 +1,7 @@
#!/bin/bash
. $(dirname $0)/../include.rc
. $(dirname $0)/../nfs.rc
cleanup;
@ -9,9 +10,9 @@ TEST pidof glusterd
TEST $CLI volume info
TEST $CLI volume create $V0 replica 2 $H0:$B0/brick0 $H0:$B0/brick1
TEST $CLI volume start $V0
sleep 5
mount -t nfs -o vers=3,nolock `hostname`:/$V0 $N0
EXPECT_WITHIN 20 "1" is_nfs_export_available;
TEST mount_nfs $H0:/$V0 $N0 nolock
cd $N0
mkdir test_hardlink_self_heal;

View File

@ -1,6 +1,7 @@
#!/bin/bash
. $(dirname $0)/../include.rc
. $(dirname $0)/../nfs.rc
cleanup;
@ -9,8 +10,6 @@ TEST pidof glusterd
TEST $CLI volume create $V0 replica 2 $H0:$B0/brick0 $H0:$B0/brick1
TEST $CLI volume start $V0
sleep 5
## Mount FUSE with caching disabled
TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 \
$M0;
@ -18,12 +17,13 @@ $M0;
TEST touch $M0/file
TEST mkdir $M0/dir
TEST mount -t nfs -o vers=3,nolock $H0:/$V0 $N0
EXPECT_WITHIN 20 "1" is_nfs_export_available;
TEST mount_nfs $H0:/$V0 $N0 nolock
cd $N0
rm -rf * &
TEST mount -t nfs -o retry=0,nolock,vers=3 $H0:/$V0 $N1;
TEST mount_nfs $H0:/$V0 $N1 retry=0,nolock;
cd;

View File

@ -25,7 +25,7 @@ cp /etc/passwd $M0/;
cp $M0/passwd $M0/file;
chmod 600 $M0/file;
TEST mount -t nfs -o vers=3,nolock $H0:/$V0 $N0;
TEST mount_nfs $H0:/$V0 $N0 nolock;
chown -R nfsnobody:nfsnobody $M0/dir;
chown -R tmp_user:tmp_user $M0/other;

View File

@ -39,7 +39,7 @@ EXPECT_WITHIN 20 1 is_nfs_export_available
# before mounting the rmtab should be empty
EXPECT '0' count_lines /var/lib/glusterd/nfs/rmtab
TEST mount -t nfs -o vers=3,nolock $H0:/$V0 $N0
TEST mount_nfs $H0:/$V0 $N0 nolock
# the output would looks similar to:
#
# hostname-0=172.31.122.104
@ -48,7 +48,7 @@ TEST mount -t nfs -o vers=3,nolock $H0:/$V0 $N0
EXPECT '2' count_lines /var/lib/glusterd/nfs/rmtab
# duplicate mounts should not be recorded (client could have crashed)
TEST mount -t nfs -o vers=3,nolock $H0:/$V0 $N1
TEST mount_nfs $H0:/$V0 $N1 nolock
EXPECT '2' count_lines /var/lib/glusterd/nfs/rmtab
# removing a mount should (even if there are two) should remove the entry
@ -76,7 +76,7 @@ TEST gluster volume set $V0 nfs.mount-rmtab $M0/rmtab
EXPECT_WITHIN 20 1 is_nfs_export_available
# a new mount should be added to the rmtab, not overwrite exiting ones
TEST mount -t nfs -o vers=3,nolock $H0:/$V0 $N0
TEST mount_nfs $H0:/$V0 $N0 nolock
EXPECT '4' count_lines $M0/rmtab
TEST umount $N0

View File

@ -13,7 +13,7 @@ TEST $CLI volume create $V0 $H0:$B0/$V0;
TEST $CLI volume start $V0
EXPECT_WITHIN 20 1 is_nfs_export_available
TEST mount -t nfs -o vers=3,nolock,soft,intr $H0:/$V0 $N0
TEST mount_nfs $H0:/$V0 $N0 nolock
TEST mkdir $N0/dir1
TEST umount $N0
@ -23,7 +23,7 @@ TEST umount $N0
TEST $CLI volume set $V0 export-dir \""/dir1(127.0.0.1)"\"
EXPECT_WITHIN 20 2 is_nfs_export_available
TEST mount -t nfs -o vers=3,nolock,soft,intr localhost:/$V0/dir1 $N0
TEST mount_nfs localhost:/$V0/dir1 $N0 nolock
TEST umount $N0
#
@ -33,7 +33,7 @@ TEST umount $N0
TEST $CLI volume set $V0 export-dir \""/dir1(8.8.8.8)"\"
EXPECT_WITHIN 20 2 is_nfs_export_available
TEST ! mount -t nfs -o vers=3,nolock,soft,intr $H0:/$V0/dir1 $N0
TEST ! mount_nfs $H0:/$V0/dir1 $N0 nolock
TEST ! umount $N0
@ -43,7 +43,7 @@ TEST ! umount $N0
TEST $CLI volume set $V0 export-dir \""/dir1($H0)"\"
EXPECT_WITHIN 20 2 is_nfs_export_available
TEST mount -t nfs -o vers=3,nolock,soft,intr $H0:/$V0/dir1 $N0
TEST mount_nfs $H0:/$V0/dir1 $N0 nolock
TEST umount $N0
# Case 4: Variation of test case1. Here we are checking with IP range
@ -51,7 +51,7 @@ TEST umount $N0
TEST $CLI volume set $V0 export-dir \""/dir1(127.0.0.0/24)"\"
EXPECT_WITHIN 20 2 is_nfs_export_available
TEST mount -t nfs -o vers=3,nolock,soft,intr localhost:/$V0/dir1 $N0
TEST mount_nfs localhost:/$V0/dir1 $N0 nolock
TEST umount $N0
## Finish up

View File

@ -2,6 +2,7 @@
. $(dirname $0)/../include.rc
. $(dirname $0)/../volume.rc
. $(dirname $0)/../nfs.rc
cleanup;
@ -22,10 +23,9 @@ EXPECT 'Created' volinfo_field $V0 'Status';
TEST $CLI volume start $V0;
EXPECT 'Started' volinfo_field $V0 'Status';
sleep 3
MOUNTDIR=$N0;
TEST mount -t nfs -o vers=3,nolock,soft,timeo=30,retrans=1 $H0:/$V0 $N0
EXPECT_WITHIN 20 "1" is_nfs_export_available;
TEST mount_nfs $H0:/$V0 $N0 nolock,timeo=30,retrans=1
TEST touch $N0/testfile
TEST $CLI volume set $V0 debug.error-gen client

View File

@ -12,7 +12,7 @@ TEST pidof glusterd
TEST $CLI volume create $V0 $H0:$B0/$V0
TEST $CLI volume start $V0
EXPECT_WITHIN 20 1 is_nfs_export_available
TEST mount -t nfs -o vers=3,nolock,soft,intr $H0:/$V0 $N0
TEST mount_nfs $H0:/$V0 $N0 nolock
TEST umount $N0
# based on ip addresses (1-4)
@ -20,26 +20,26 @@ TEST umount $N0
TEST $CLI volume set $V0 nfs.rpc-auth-allow 127.0.0.1
EXPECT_WITHIN 20 1 is_nfs_export_available
TEST mount -t nfs -o vers=3,nolock,soft,intr localhost:/$V0 $N0
TEST mount_nfs localhost:/$V0 $N0 nolock
TEST umount $N0
# case 2: allow only non-localhost ip
TEST $CLI volume set $V0 nfs.rpc-auth-allow 192.168.1.1
EXPECT_WITHIN 20 1 is_nfs_export_available
#11
TEST ! mount -t nfs -o vers=3,nolock,soft,intr localhost:/$V0 $N0
TEST ! mount_nfs localhost:/$V0 $N0 nolock
TEST $CLI volume reset --mode=script $V0
# case 3: reject only localhost ip
TEST $CLI volume set $V0 nfs.rpc-auth-reject 127.0.0.1
EXPECT_WITHIN 20 1 is_nfs_export_available
TEST ! mount -t nfs -o vers=3,nolock,soft,intr localhost:/$V0 $N0
TEST ! mount_nfs localhost:/$V0 $N0 nolock
# case 4: reject only non-localhost ip
TEST $CLI volume set $V0 nfs.rpc-auth-reject 192.168.1.1
EXPECT_WITHIN 20 1 is_nfs_export_available
TEST mount -t nfs -o vers=3,nolock,soft,intr localhost:/$V0 $N0
TEST mount_nfs localhost:/$V0 $N0 nolock
TEST umount $N0
@ -50,21 +50,21 @@ TEST $CLI volume reset --mode=script $V0
TEST $CLI volume set $V0 nfs.addr-namelookup on
EXPECT_WITHIN 20 1 is_nfs_export_available
#20
TEST mount -t nfs -o vers=3,nolock,soft,intr localhost:/$V0 $N0
TEST mount_nfs localhost:/$V0 $N0 nolock
TEST umount $N0
# case 5: allow only localhost
TEST $CLI volume set $V0 nfs.rpc-auth-allow localhost
EXPECT_WITHIN 20 1 is_nfs_export_available
TEST mount -t nfs -o vers=3,nolock,soft,intr localhost:/$V0 $N0
TEST mount_nfs localhost:/$V0 $N0 nolock
TEST umount $N0
# case 6: allow only somehost
TEST $CLI volume set $V0 nfs.rpc-auth-allow somehost
EXPECT_WITHIN 20 1 is_nfs_export_available
TEST ! mount -t nfs -o vers=3,nolock,soft,intr localhost:/$V0 $N0
TEST ! mount_nfs localhost:/$V0 $N0 nolock
# case 7: reject only localhost
TEST $CLI volume reset --mode=script $V0
@ -72,13 +72,13 @@ TEST $CLI volume set $V0 nfs.addr-namelookup on
TEST $CLI volume set $V0 nfs.rpc-auth-reject localhost
EXPECT_WITHIN 20 1 is_nfs_export_available
#30
TEST ! mount -t nfs -o vers=3,nolock,soft,intr localhost:/$V0 $N0
TEST ! mount_nfs localhost:/$V0 $N0 nolock
# case 8: reject only somehost
TEST $CLI volume set $V0 nfs.rpc-auth-reject somehost
EXPECT_WITHIN 20 1 is_nfs_export_available
TEST mount -t nfs -o vers=3,nolock,soft,intr localhost:/$V0 $N0
TEST mount_nfs localhost:/$V0 $N0 nolock
TEST umount $N0
# based on ip addresses: repeat of cases 1-4
@ -88,7 +88,7 @@ TEST $CLI volume set $V0 nfs.addr-namelookup on
TEST $CLI volume set $V0 nfs.rpc-auth-allow 127.0.0.1
EXPECT_WITHIN 20 1 is_nfs_export_available
TEST mount -t nfs -o vers=3,nolock,soft,intr localhost:/$V0 $N0
TEST mount_nfs localhost:/$V0 $N0 nolock
TEST mkdir -p $N0/subdir
TEST umount $N0
@ -96,7 +96,7 @@ TEST umount $N0
TEST $CLI volume set $V0 nfs.rpc-auth-allow 192.168.1.1
EXPECT_WITHIN 20 1 is_nfs_export_available
#41
TEST ! mount -t nfs -o vers=3,nolock,soft,intr localhost:/$V0 $N0
TEST ! mount_nfs localhost:/$V0 $N0 nolock
# case 11: reject only localhost ip
TEST $CLI volume reset --mode=script $V0
@ -104,17 +104,17 @@ TEST $CLI volume set $V0 nfs.addr-namelookup on
TEST $CLI volume set $V0 nfs.rpc-auth-reject 127.0.0.1
EXPECT_WITHIN 20 1 is_nfs_export_available
TEST ! mount -t nfs -o vers=3,nolock,soft,intr localhost:/$V0 $N0
TEST ! mount -t nfs -o vers=3,nolock,soft,intr localhost:/$V0/subdir $N0
TEST ! mount_nfs localhost:/$V0 $N0 nolock
TEST ! mount_nfs localhost:/$V0/subdir $N0 nolock
# case 12: reject only non-localhost ip
TEST $CLI volume set $V0 nfs.rpc-auth-reject 192.168.1.1
EXPECT_WITHIN 20 1 is_nfs_export_available
TEST mount -t nfs -o vers=3,nolock,soft,intr localhost:/$V0 $N0
TEST mount_nfs localhost:/$V0 $N0 nolock
TEST umount $N0
TEST mount -t nfs -o vers=3,nolock,soft,intr localhost:/$V0/subdir $N0
TEST mount_nfs localhost:/$V0/subdir $N0 nolock
TEST umount $N0
TEST $CLI volume stop --mode=script $V0

View File

@ -1,6 +1,7 @@
#!/bin/bash
. $(dirname $0)/../include.rc
. $(dirname $0)/../nfs.rc
cleanup;
@ -14,9 +15,8 @@ sleep 1;
## Mount FUSE with caching disabled
TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0;
sleep 1;
TEST mount -t nfs -o vers=3,nolock $H0:/$V0 $N0;
EXPECT_WITHIN 20 "1" is_nfs_export_available;
TEST mount_nfs $H0:/$V0 $N0 nolock;
TEST mkdir $M0/dir;

View File

@ -1,6 +1,7 @@
#!/bin/bash
. $(dirname $0)/../include.rc
. $(dirname $0)/../volume.rc
. $(dirname $0)/../nfs.rc
cleanup;
@ -10,8 +11,8 @@ TEST $CLI volume create $V0 $H0:$B0/${V0}{0,1}
TEST $CLI volume start $V0;
TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0;
sleep 1;
TEST mount -t nfs -o vers=3,nolock $H0:/$V0 $N0;
EXPECT_WITHIN 20 "1" is_nfs_export_available;
TEST mount_nfs $H0:/$V0 $N0 nolock;
sleep 2;

View File

@ -2,6 +2,7 @@
. $(dirname $0)/../include.rc
. $(dirname $0)/../volume.rc
. $(dirname $0)/../nfs.rc
#This tests if eager-lock blocks metadata operations on nfs/fuse mounts.
#If it is not woken up, INODELK from the next command waits
@ -18,8 +19,8 @@ TEST $CLI volume set $V0 cluster.post-op-delay-secs 3
TEST $CLI volume start $V0
TEST $CLI volume profile $V0 start
sleep 5
TEST mount -t nfs -o vers=3,nolock $H0:/$V0 $N0;
EXPECT_WITHIN 20 "1" is_nfs_export_available;
TEST mount_nfs $H0:/$V0 $N0 nolock;
TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id=$V0 $M0
echo 1 > $N0/1 && chmod +x $N0/1
echo 1 > $M0/1 && chmod +x $M0/1

View File

@ -2,6 +2,7 @@
. $(dirname $0)/../include.rc
. $(dirname $0)/../volume.rc
. $(dirname $0)/../nfs.rc
#This script checks that nfs mount does not fail lookup on files with split-brain
cleanup;
@ -11,8 +12,8 @@ TEST pidof glusterd
TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1}
TEST $CLI volume set $V0 self-heal-daemon off
TEST $CLI volume start $V0
sleep 5
TEST mount -t nfs -o vers=3 $H0:/$V0 $N0
EXPECT_WITHIN 20 "1" is_nfs_export_available;
TEST mount_nfs $H0:/$V0 $N0
TEST touch $N0/1
TEST kill_brick ${V0} ${H0} ${B0}/${V0}1
echo abc > $N0/1

View File

@ -8,7 +8,7 @@
#
function is_nfs_export_available ()
{
vol=$1
local vol=$1
if [ "$vol" == "" ]; then
vol=$V0
@ -18,4 +18,11 @@ function is_nfs_export_available ()
echo "$exp"
}
function mount_nfs ()
{
local e=$1
local m=$2
local opt=$3
if [ ! -z "$opt" ]; then opt=",$opt"; fi
mount -t nfs -o soft,intr,vers=3"$opt" $e $m
}