diff --git a/tests/tests/fence-and-reclaim.sh b/tests/tests/fence-and-reclaim.sh index 7648bb2c..1a4269a0 100644 --- a/tests/tests/fence-and-reclaim.sh +++ b/tests/tests/fence-and-reclaim.sh @@ -5,6 +5,9 @@ t_require_commands sleep touch grep sync scoutfs t_require_mounts 2 +# regularly see ~20/~30s +VERIFY_TIMEOUT_SECS=90 + # # Make sure that all mounts can read the results of a write from each # mount. @@ -40,8 +43,10 @@ verify_fenced_run() for rid in $rids; do grep -q ".* running rid '$rid'.* args 'ignored run args'" "$T_FENCED_LOG" || \ - t_fail "fenced didn't execute RUN script for rid $rid" + return 1 done + + return 0 } echo "== make sure all mounts can see each other" @@ -54,14 +59,7 @@ rid=$(t_mount_rid $cl) echo "cl $cl sv $sv rid $rid" >> "$T_TMP.log" sync t_force_umount $cl -# wait for client reconnection to timeout -while grep -q $rid $(t_debugfs_path $sv)/connections; do - sleep .5 -done -while t_rid_is_fencing $rid; do - sleep .5 -done -verify_fenced_run $rid +t_wait_until_timeout $VERIFY_TIMEOUT_SECS verify_fenced_run $rid t_mount $cl check_read_write @@ -83,15 +81,7 @@ for cl in $(t_fs_nrs); do t_force_umount $cl done -# wait for all client reconnections to timeout -while egrep -q "($pattern)" $(t_debugfs_path $sv)/connections; do - sleep .5 -done -# wait for all fence requests to complete -while test -d $(echo /sys/fs/scoutfs/*/fence/* | cut -d " " -f 1); do - sleep .5 -done -verify_fenced_run $rids +t_wait_until_timeout $VERIFY_TIMEOUT_SECS verify_fenced_run $rids # remount all the clients for cl in $(t_fs_nrs); do if [ $cl == $sv ]; then @@ -107,12 +97,7 @@ rid=$(t_mount_rid $sv) echo "sv $sv rid $rid" >> "$T_TMP.log" sync t_force_umount $sv -t_wait_for_leader -# wait until new server is done fencing unmounted leader rid -while t_rid_is_fencing $rid; do - sleep .5 -done -verify_fenced_run $rid +t_wait_until_timeout $VERIFY_TIMEOUT_SECS verify_fenced_run $rid t_mount $sv check_read_write @@ -127,11 +112,7 @@ for nr in $(t_fs_nrs); do t_force_umount $nr done t_mount_all -# wait for all fence requests to complete -while test -d $(echo /sys/fs/scoutfs/*/fence/* | cut -d " " -f 1); do - sleep .5 -done -verify_fenced_run $rids +t_wait_until_timeout $VERIFY_TIMEOUT_SECS verify_fenced_run $rids check_read_write t_pass