]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
t/git-cgi.t: Wait 1 second before doing a revert that should succeed
authorSimon McVittie <smcv@debian.org>
Sun, 14 May 2017 14:09:29 +0000 (15:09 +0100)
committerSimon McVittie <smcv@debian.org>
Sun, 14 May 2017 14:35:52 +0000 (15:35 +0100)
This hopefully fixes a race condition in which the test failed
around 6% of the time.

If we don't wait, the mtime (which is rounded down to 1 second precision
in the APIs we use) will not necessarily change, so the update will not
necessarily cause the page to be refreshed.

Bug-Debian: https://bugs.debian.org/862494

debian/changelog
t/git-cgi.t

index 14045a961e2c3d6e484a53c27e635e05a0ff3f8f..d3576c528d3791d3cd7e2901cbf6c0fb78561ec5 100644 (file)
@@ -1,3 +1,11 @@
+ikiwiki (3.20170112) UNRELEASED; urgency=medium
+
+  * t/git-cgi.t: Wait 1 second before doing a revert that should work.
+    This hopefully fixes a race condition in which the test failed
+    around 6% of the time. (Closes: 862494)
+
+ -- Simon McVittie <smcv@debian.org>  Sun, 14 May 2017 15:34:52 +0100
+
 ikiwiki (3.20170111) unstable; urgency=high
 
   * passwordauth: prevent authentication bypass via multiple name
index ee77257b97cf179efbde08b50f84d5402cda6a59..ee47261edd525497f9332c5dfe077491ef7c8fc7 100755 (executable)
@@ -291,6 +291,10 @@ sub test {
        $content = readfile('t/tmp/in/two.mdwn');
        like($content, qr{Here is new content for the second page});
 
+       # We have to wait 1 second here so that new writes are guaranteed
+       # to have a strictly larger mtime.
+       sleep 1;
+
        # This one can legitimately be reverted
        $content = run_cgi(method => 'post',
                params => {