From 0d6f054dbbeffa7190cb41746251c6b77be59a53 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Fri, 6 Nov 2015 17:39:38 +0100 Subject: tests: make mount-nfs-auth.t more stable mount-nfs-auth.t has a funky way of restarting the Gluster/NFS service. It is a little racy and does not always work. Disabling and enabling the nfs.disable volume option triggers a restart of the Gluster/NFS service too, and is much simpler. Also adding a little more EXPECT_WITHIN statements to prevent the occasional failures. Change-Id: I6765e9f021abbe995dfac00fbfc67298e2ec769c BUG: 1278476 Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/12542 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: Jeff Darcy --- run-tests.sh | 1 - tests/basic/mount-nfs-auth.t | 26 +++++++++++--------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/run-tests.sh b/run-tests.sh index 01ffa5b6f10..f94f86c35ad 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -195,7 +195,6 @@ function is_bad_test () local name=$1 for bt in ./tests/basic/quota-anon-fd-nfs.t \ ./tests/bugs/quota/bug-1235182.t \ - ./tests/basic/mount-nfs-auth.t \ ./tests/basic/quota-nfs.t \ ./tests/basic/tier/tier_lookup_heal.t \ ./tests/basic/tier/bug-1214222-directories_missing_after_attach_tier.t \ diff --git a/tests/basic/mount-nfs-auth.t b/tests/basic/mount-nfs-auth.t index f89670b7f31..6ecac5b469a 100755 --- a/tests/basic/mount-nfs-auth.t +++ b/tests/basic/mount-nfs-auth.t @@ -132,18 +132,9 @@ function stat_nfs () { # Restarts the NFS server function restart_nfs () { - PID=$(ps auxww | grep nfs | grep sbin/glusterfs | awk '{print $2}') - CMD=$(ps axww | grep nfs | grep sbin/glusterfs | \ - awk '{$1=""; $2=""; $3=""; $4=""; print $0}' | \ - sed 's/ *([^()]*)$//') - kill $PID - timeout=$PROCESS_UP_TIMEOUT; - while kill -0 $PID 2>/dev/null; do - test $timeout -eq 0 && break - timout=$(( $timeout - 1 )) - sleep 1 - done - $CMD + # disabling nfs acces for a volume requires a restart + $CLI volume set patchy nfs.disable true + $CLI volume reset patchy nfs.disable } setup_cluster @@ -214,6 +205,7 @@ TEST export_deny_this_host TEST netgroup_allow_this_host # wait for the mount authentication to rebuild +sleep $[$AUTH_REFRESH_INTERVAL + 1] EXPECT_WITHIN $MY_MOUNT_TIMEOUT "Y" check_mount_success $V0 EXPECT "Y" small_write @@ -252,8 +244,8 @@ TEST export_allow_this_host_ro TEST netgroup_deny_this_host ## Restart the nfs server to avoid spurious failure(BZ1256352) -$CLI vol stop $V0 -$CLI vol start $V0 +restart_nfs +EXPECT_WITHIN $NFS_EXPORT_TIMEOUT "1" is_nfs_export_available EXPECT_WITHIN $MY_MOUNT_TIMEOUT "Y" check_mount_success $V0 EXPECT "N" small_write # Writes should not be allowed @@ -266,12 +258,16 @@ TEST netgroup_deny_this_host TEST export_allow_this_host_l1 # Allow this host at L1 EXPECT_WITHIN $MY_MOUNT_TIMEOUT "Y" check_mount_failure $V0 #V0 shouldnt be allowed -EXPECT "Y" check_mount_success $V0L1 #V0L1 should be +EXPECT_WITHIN $MY_MOUNT_TIMEOUT "Y" check_mount_success $V0L1 #V0L1 should be EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" umount_nfs $N0 ## Test wildcard hosts TEST export_allow_wildcard +# the $MY_MOUNT_TIMEOUT might not be long enough? restart should do +restart_nfs +EXPECT_WITHIN $NFS_EXPORT_TIMEOUT "1" is_nfs_export_available + EXPECT_WITHIN $MY_MOUNT_TIMEOUT "Y" check_mount_success $V0 EXPECT_WITHIN $AUTH_REFRESH_INTERVAL "Y" small_write EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" umount_nfs $N0 -- cgit