summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2015-08-18 21:32:35 -0700
committerRuss Allbery <eagle@eyrie.org>2015-08-18 21:32:35 -0700
commitb46738c29eac0e88363a305da9cb026a5a8196a9 (patch)
treec179600558fd56b2a2bf7e9ece7f55c2254bb2aa
parentc2b395d73f55a6b6a44e2c262e8b24dad98a6c69 (diff)
Make the tools/backend test less sensitive to precise timing
-rwxr-xr-xtests/tools/backend-t15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/tools/backend-t b/tests/tools/backend-t
index 30f265c..3da82cc 100755
--- a/tests/tools/backend-t
+++ b/tests/tools/backend-t
@@ -87,9 +87,9 @@ sub run_backend_checked {
# Given a user, an action, and (for a password change) the new password,
# locate that queued action and check that the correct information was stored
-# for it. Expects the action to have been queued in the past second. Reports
-# results with Test::More functions. Always uses a directory named 'queue'
-# under test_tmpdir() as the queue directory.
+# for it. Expects the action to have been queued in the five seconds.
+# Reports results with Test::More functions. Always uses a directory named
+# 'queue' under test_tmpdir() as the queue directory.
#
# $user - User for which the action should be queued
# $action - The queued action, chosen from enable, disable, or password
@@ -109,9 +109,12 @@ sub check_queued_action {
# with the same timestamp with a non-zero sequence number.
my $now = time;
my $path;
- for my $time ($now - 1 .. $now) {
- $path = $base . strftime('%Y%m%dT%H%M%SZ-00', gmtime($time));
- last if -f $path;
+ for my $time ($now - 10 .. $now + 1) {
+ my $candidate = $base . strftime('%Y%m%dT%H%M%SZ-00', gmtime($time));
+ if (-f $candidate) {
+ $path = $candidate;
+ last;
+ }
}
ok(defined($path), 'Queued change found');