tests: improve test coverage for discovery and actual parameters for pulling stable
authorMads Kiilerich <madski@unity3d.com>
Fri, 15 Aug 2014 03:24:40 +0200
branchstable
changeset 22181 851db07bb2de
parent 22180 17011b36aac7
child 22182 510cafe72004
tests: improve test coverage for discovery and actual parameters for pulling
tests/test-setdiscovery.t
tests/test-treediscovery.t
--- a/tests/test-setdiscovery.t	Fri Aug 15 02:46:44 2014 +0200
+++ b/tests/test-setdiscovery.t	Fri Aug 15 03:24:40 2014 +0200
@@ -324,4 +324,30 @@
   5 total queries
   common heads: 3ee37d65064a
 
+Test actual protocol when pulling one new head in addition to common heads
+
+  $ hg clone -U b c
+  $ hg -R c id -ir tip
+  513314ca8b3a
+  $ hg -R c up -qr default
+  $ touch c/f
+  $ hg -R c ci -Aqm "extra head"
+  $ hg -R c id -i
+  e64a39e7da8b
+
+  $ hg serve -R c -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
+  $ cat hg.pid >> $DAEMON_PIDS
+
+  $ hg -R b incoming http://localhost:$HGPORT/ -T '{node|short}\n'
+  comparing with http://localhost:$HGPORT/
+  searching for changes
+  e64a39e7da8b
+
+  $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
+  $ cut -d' ' -f6- access.log | grep -v cmd=known # cmd=known uses random sampling
+  "GET /?cmd=capabilities HTTP/1.1" 200 -
+  "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D513314ca8b3ae4dac8eec56966265b00fcf866db
+  "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=513314ca8b3ae4dac8eec56966265b00fcf866db&heads=e64a39e7da8b0d54bc63e81169aff001c13b3477+513314ca8b3ae4dac8eec56966265b00fcf866db
+  $ cat errors.log
+
   $ cd ..
--- a/tests/test-treediscovery.t	Fri Aug 15 02:46:44 2014 +0200
+++ b/tests/test-treediscovery.t	Fri Aug 15 03:24:40 2014 +0200
@@ -17,11 +17,13 @@
   >   echo '[web]' > $1/.hg/hgrc
   >   echo 'push_ssl = false' >> $1/.hg/hgrc
   >   echo 'allow_push = *' >> $1/.hg/hgrc
-  >   hg serve -R $1 -p $HGPORT -d --pid-file=hg.pid -E errors.log
+  >   hg serve -R $1 -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
   >   cat hg.pid >> $DAEMON_PIDS
   > }
   $ tstop() {
   >   "$TESTDIR/killdaemons.py" $DAEMON_PIDS
+  >   [ "$1" ] && cut -d' ' -f6- access.log && cat errors.log
+  >   rm access.log errors.log
   > }
 
 Both are empty:
@@ -188,10 +190,11 @@
   no changes found
   [1]
   $ cd ..
+  $ tstop
 
 Remote is empty:
 
-  $ tstop ; tstart empty2
+  $ tstart empty2
   $ cd main
   $ hg incoming $remote
   comparing with http://localhost:$HGPORT/
@@ -230,10 +233,10 @@
   no changes found
   [1]
   $ cd ..
+  $ tstop
 
 Local is superset:
 
-  $ tstop
   $ hg clone main subset2 --rev name2
   adding changesets
   adding manifests
@@ -280,10 +283,11 @@
   no changes found
   [1]
   $ cd ..
+  $ tstop
 
 Partial pull:
 
-  $ tstop ; tstart main
+  $ tstart main
   $ hg clone $remote partial --rev name2
   adding changesets
   adding manifests
@@ -322,10 +326,10 @@
   10 8b6bad1512e1: r10 both
   11 a19bfa7e7328: r11 both
   $ cd ..
+  $ tstop
 
 Both have new stuff in new named branches:
 
-  $ tstop
   $ hg clone main repo1a --rev name1 -q
   $ hg clone repo1a repo1b -q
   $ hg clone main repo2a --rev name2 -q
@@ -372,8 +376,9 @@
   no changes found
   [1]
   $ cd ..
+  $ tstop
 
-  $ tstop ; tstart repo1b
+  $ tstart repo1b
   $ cd repo2b
   $ hg incoming $remote
   comparing with http://localhost:$HGPORT/
@@ -414,10 +419,10 @@
   no changes found
   [1]
   $ cd ..
+  $ tstop
 
 Both have new stuff in existing named branches:
 
-  $ tstop
   $ rm -r repo1a repo1b repo2a repo2b
   $ hg clone main repo1a --rev 3 --rev 8 -q
   $ hg clone repo1a repo1b -q
@@ -460,8 +465,9 @@
   no changes found
   [1]
   $ cd ..
+  $ tstop
 
-  $ tstop ; tstart repo1b
+  $ tstart repo1b
   $ cd repo2b
   $ hg incoming $remote
   comparing with http://localhost:$HGPORT/
@@ -497,6 +503,32 @@
   no changes found
   [1]
   $ cd ..
-
-  $ tstop
-
+  $ tstop show
+  "GET /?cmd=capabilities HTTP/1.1" 200 -
+  "GET /?cmd=heads HTTP/1.1" 200 -
+  "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961
+  "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785
+  "GET /?cmd=changegroupsubset HTTP/1.1" 200 - x-hgarg-1:bases=d8f638ac69e9ae8dea4f09f11d696546a912d961&heads=d8f638ac69e9ae8dea4f09f11d696546a912d961+2c8d5d5ec612be65cdfdeac78b7662ab1696324a
+  "GET /?cmd=capabilities HTTP/1.1" 200 -
+  "GET /?cmd=heads HTTP/1.1" 200 -
+  "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961
+  "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785
+  "GET /?cmd=capabilities HTTP/1.1" 200 -
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
+  "GET /?cmd=heads HTTP/1.1" 200 -
+  "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961
+  "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785
+  "GET /?cmd=changegroupsubset HTTP/1.1" 200 - x-hgarg-1:bases=d8f638ac69e9ae8dea4f09f11d696546a912d961&heads=d8f638ac69e9ae8dea4f09f11d696546a912d961+2c8d5d5ec612be65cdfdeac78b7662ab1696324a
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases
+  "GET /?cmd=capabilities HTTP/1.1" 200 -
+  "GET /?cmd=heads HTTP/1.1" 200 -
+  "GET /?cmd=branchmap HTTP/1.1" 200 -
+  "GET /?cmd=branchmap HTTP/1.1" 200 -
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
+  "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=686173686564+1827a5bb63e602382eb89dd58f2ac9f3b007ad91
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
+  "GET /?cmd=capabilities HTTP/1.1" 200 -
+  "GET /?cmd=heads HTTP/1.1" 200 -
+  "GET /?cmd=capabilities HTTP/1.1" 200 -
+  "GET /?cmd=heads HTTP/1.1" 200 -