Patchwork [1,of,2,v2] test-clone: fix some instability in pooled clone race condition test

login
register
mail settings
Submitter Augie Fackler
Date Oct. 9, 2016, 7:32 p.m.
Message ID <340c57968bc1a37877df.1476041539@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/17018/
State Accepted
Headers show

Comments

Augie Fackler - Oct. 9, 2016, 7:32 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1476001522 14400
#      Sun Oct 09 04:25:22 2016 -0400
# Node ID 340c57968bc1a37877df68c3ce5105a590129715
# Parent  74cd33c9be76c11ba42ba5f2448dcf90419866ba
test-clone: fix some instability in pooled clone race condition test

Healthy output (one log file mentioning "existing pooled" and one
mentioning "new pooled") will now print in a stable order, but
unhealthy output will print some sort of error.

This reduces the flakiness of the test from 55% to 38%. My next patch
makes it completely stable.

Patch

diff --git a/tests/test-clone.t b/tests/test-clone.t
--- a/tests/test-clone.t
+++ b/tests/test-clone.t
@@ -1060,7 +1060,12 @@  Cloning into pooled storage doesn't race
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     1a
   
-  $ cat race1.log
+One repo should be new, the other should be shared from the pool. We
+don't care which is which, so we just make sure we always print the
+one containing "new pooled" first, then one one containing "existing
+pooled".
+
+  $ grep 'new pooled' race1.log > /dev/null && cat race1.log || cat race2.log
   (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
   requesting all changes
   adding changesets
@@ -1073,7 +1078,7 @@  Cloning into pooled storage doesn't race
   updating working directory
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
-  $ cat race2.log
+  $ grep 'existing pooled' race1.log > /dev/null && cat race1.log || cat race2.log
   (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
   waiting for lock on repository share-destrace2 held by * (glob)
   got lock after \d+ seconds (re)