diff options
author | Jeff Darcy <jdarcy@redhat.com> | 2015-10-19 16:05:17 -0400 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2015-10-27 04:20:50 -0700 |
commit | ad876d7a127cf56a3cca11c24ad2b20e1955f82b (patch) | |
tree | 178622d1ef79943ab2225cb7b99cee41bb6a90c0 | |
parent | 8216ecb871c8d74edcc46b7f13d1e1879be25de1 (diff) |
tests: fix timeout in mount-nfs-auth.t
The mount timeout was too short. The normal configuration-change path
(construct graph, call reconfigure) and the auth-refresh path might in
effect run serially. Therefore we have to wait for the *sum* of those
two intervals. As with all too-short-timeout problems, the result was
that the test would run fine most of the time. However, it has caused
spurious failures on my own patches a half dozen times, and I have a
half dozen other emails about it nuking other people's as well (most
often but not always on NetBSD).
The fix, obviously, is to calculate and use the right timeout value for
NFS mount actions. Other actions and timeouts have been left alone.
Change-Id: Ic8f013c8c830e33c48bcc6d1b603d6d22a8ba3c5
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/12396
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
-rwxr-xr-x | tests/basic/mount-nfs-auth.t | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/tests/basic/mount-nfs-auth.t b/tests/basic/mount-nfs-auth.t index 6e99dd58ad0..f89670b7f31 100755 --- a/tests/basic/mount-nfs-auth.t +++ b/tests/basic/mount-nfs-auth.t @@ -3,6 +3,12 @@ . $(dirname $0)/../include.rc . $(dirname $0)/../nfs.rc +# Our mount timeout must be as long as the time for a regular configuration +# change to be acted upon *plus* AUTH_REFRESH_TIMEOUT, not one replacing the +# other. Otherwise this process races vs. the one making the change we're +# trying to test, which leads to spurious failures. +MY_MOUNT_TIMEOUT=$((CONFIG_UPDATE_TIMEOUT+AUTH_REFRESH_INTERVAL)) + cleanup; ## Check whether glusterd is running TEST glusterd @@ -166,7 +172,7 @@ TEST netgroup_deny_this_host ## Technically deauthorized this host, but since auth is disabled we should be ## able to do mounts, writes, etc. -EXPECT_WITHIN $AUTH_REFRESH_INTERVAL "Y" check_mount_success $V0 +EXPECT_WITHIN $MY_MOUNT_TIMEOUT "Y" check_mount_success $V0 EXPECT "Y" small_write EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" umount_nfs $N0 @@ -200,7 +206,7 @@ EXPECT "Y" check_mount_failure $V0 TEST export_allow_this_host TEST netgroup_allow_this_host -EXPECT_WITHIN $AUTH_REFRESH_INTERVAL "Y" check_mount_success $V0 +EXPECT_WITHIN $MY_MOUNT_TIMEOUT "Y" check_mount_success $V0 EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" umount_nfs $N0 ## Allow host in netgroups but not in exports, host should be allowed @@ -208,9 +214,8 @@ TEST export_deny_this_host TEST netgroup_allow_this_host # wait for the mount authentication to rebuild -sleep $[$AUTH_REFRESH_INTERVAL + 1] -EXPECT "Y" check_mount_success $V0 +EXPECT_WITHIN $MY_MOUNT_TIMEOUT "Y" check_mount_success $V0 EXPECT "Y" small_write TEST big_write EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" umount_nfs $N0 @@ -219,14 +224,14 @@ EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" umount_nfs $N0 TEST export_allow_this_host TEST netgroup_deny_this_host -EXPECT_WITHIN $AUTH_REFRESH_INTERVAL "Y" check_mount_success $V0 +EXPECT_WITHIN $MY_MOUNT_TIMEOUT "Y" check_mount_success $V0 EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" umount_nfs $N0 ## Finally, reauth the host in export and netgroup, test mount & write TEST export_allow_this_host_l1 TEST netgroup_allow_this_host -EXPECT_WITHIN $AUTH_REFRESH_INTERVAL "Y" check_mount_success $V0L1 +EXPECT_WITHIN $MY_MOUNT_TIMEOUT "Y" check_mount_success $V0L1 EXPECT "Y" small_write ## Failover test: Restarting NFS and then doing a write should pass @@ -250,7 +255,7 @@ TEST netgroup_deny_this_host $CLI vol stop $V0 $CLI vol start $V0 -EXPECT_WITHIN $AUTH_REFRESH_INTERVAL "Y" check_mount_success $V0 +EXPECT_WITHIN $MY_MOUNT_TIMEOUT "Y" check_mount_success $V0 EXPECT "N" small_write # Writes should not be allowed TEST ! create # Create should not be allowed TEST stat_nfs # Stat should be allowed @@ -260,14 +265,14 @@ TEST export_deny_this_host TEST netgroup_deny_this_host TEST export_allow_this_host_l1 # Allow this host at L1 -EXPECT_WITHIN $AUTH_REFRESH_INTERVAL "Y" check_mount_failure $V0 #V0 shouldnt be allowed +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 $UMOUNT_TIMEOUT "Y" umount_nfs $N0 ## Test wildcard hosts TEST export_allow_wildcard -EXPECT_WITHIN $AUTH_REFRESH_INTERVAL "Y" check_mount_success $V0 +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 @@ -279,7 +284,7 @@ EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" umount_nfs $N0 TEST export_allow_this_host_with_slash -EXPECT_WITHIN $AUTH_REFRESH_INTERVAL "Y" check_mount_success $V0 +EXPECT_WITHIN $MY_MOUNT_TIMEOUT "Y" check_mount_success $V0 EXPECT "Y" small_write EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" umount_nfs $N0 @@ -297,7 +302,7 @@ EXPECT_WITHIN $NFS_EXPORT_TIMEOUT "1" is_nfs_export_available TEST export_deny_this_host # Deny the host TEST netgroup_deny_this_host -EXPECT_WITHIN $AUTH_REFRESH_INTERVAL "Y" check_mount_success $V0 # Do a mount & test +EXPECT_WITHIN $MY_MOUNT_TIMEOUT "Y" check_mount_success $V0 # Do a mount & test EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" umount_nfs $N0 ## Turn back on the exports authentication |