[PATCH 2 of 6] test: pull through http when testing for race conditions

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Jun 5 00:19:59 CDT 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1433206035 25200
#      Mon Jun 01 17:47:15 2015 -0700
# Node ID a7c932b591d591c9d02badda319b0924b215fb7d
# Parent  e699ed1229521d06cd575e300faec213c9a7239b
test: pull through http when testing for race conditions

The http server is stateless giving more occasion for race. We switch the test
to http before adding extra cases tests.

diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -261,31 +261,42 @@ update a remote bookmark from a non-head
 
 update a bookmark in the middle of a client pulling changes
 
   $ cd ..
   $ hg clone -q a pull-race
-  $ hg clone -q pull-race pull-race2
+
+# we want to use http because it is state less and therefore more succeptible to race condition
+
+  $ hg -R pull-race serve -p $HGPORT -d --pid-file=pull-race.pid -E main-error.log
+  $ cat pull-race.pid >> $DAEMON_PIDS
+
+  $ hg clone -q http://localhost:$HGPORT/ pull-race2
   $ cd pull-race
   $ hg up -q Y
   $ echo c4 > f2
   $ hg ci -Am4
   $ echo c5 > f3
   $ cat <<EOF > .hg/hgrc
   > [hooks]
   > outgoing.makecommit = hg ci -Am5; echo committed in pull-race
   > EOF
-  $ cd ../pull-race2
+
+(new config need server restart)
+
+  $ cd ..
+  $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
+  $ hg -R pull-race serve -p $HGPORT -d --pid-file=pull-race.pid -E main-error.log
+  $ cat pull-race.pid >> $DAEMON_PIDS
+  $ cd pull-race2
   $ hg -R $TESTTMP/pull-race book
      @                         1:0d2164f0ce0d
      X                         1:0d2164f0ce0d
    * Y                         4:b0a5eff05604
      Z                         1:0d2164f0ce0d
   $ hg pull
-  pulling from $TESTTMP/pull-race (glob)
+  pulling from http://localhost:$HGPORT/
   searching for changes
-  adding f3
-  committed in pull-race
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
   updating bookmark Y
@@ -293,10 +304,14 @@ update a bookmark in the middle of a cli
   $ hg book
    * @                         1:0d2164f0ce0d
      X                         1:0d2164f0ce0d
      Y                         4:b0a5eff05604
      Z                         1:0d2164f0ce0d
+
+(done with this section of the test)
+
+  $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
   $ cd ../b
 
 diverging a remote bookmark fails
 
   $ hg up -q 4e3505fd9583


More information about the Mercurial-devel mailing list