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

login
register
mail settings
Submitter Pierre-Yves David
Date June 5, 2015, 5:19 a.m.
Message ID <a7c932b591d591c9d02b.1433481599@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/9512/
State Accepted
Headers show

Comments

Pierre-Yves David - June 5, 2015, 5:19 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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