From 2035a70bcc19b29a3944c71abc73a9beb90652e2 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Thu, 19 Nov 2015 15:58:37 +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. Cherry picked from commit 0d6f054dbbeffa7190cb41746251c6b77be59a53: > 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 Change-Id: I6765e9f021abbe995dfac00fbfc67298e2ec769c BUG: 1283679 Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/12664 Tested-by: Gluster Build System Tested-by: NetBSD Build System Reviewed-by: jiffin tony Thottan Reviewed-by: Vijay Bellur --- tests/basic/mount-nfs-auth.t | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'tests/basic') diff --git a/tests/basic/mount-nfs-auth.t b/tests/basic/mount-nfs-auth.t index e6376bbfa89..369333241c1 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 @@ -216,6 +207,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 @@ -254,8 +246,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 @@ -268,12 +260,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