[PATCH 2 of 9 remotefilelog-ext getfile-http] test-http: new test that demonstrates a few defects

Augie Fackler raf at durin42.com
Wed Jul 1 15:05:39 CDT 2015


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1435610634 14400
#      Mon Jun 29 16:43:54 2015 -0400
# Node ID 41771848adf150766c9e5169c2787e80715b9116
# Parent  0b1c8aee65839b5515c2a203d51b2d7fe9ed057b
test-http: new test that demonstrates a few defects

1) The client doesn't look-before-you-leap on the remotefilelog capability

2) The http server crashes ungracefully when handling a remotefilelog
request (ideally it should respond with '400 No Such Method' as a
server without the extension would.)

3) capabilities are inconsistently advertised between cmd=hello and
cmd=capabilities.

Future patches will attempt to clean up most of this.

diff --git a/tests/test-http.t b/tests/test-http.t
new file mode 100644
--- /dev/null
+++ b/tests/test-http.t
@@ -0,0 +1,36 @@
+  $ . "$TESTDIR/library.sh"
+
+  $ hginit master
+  $ cd master
+  $ cat >> .hg/hgrc <<EOF
+  > [remotefilelog]
+  > server=True
+  > EOF
+  $ echo x > x
+  $ hg commit -qAm x
+Bug: remotefilelog tries to fetch from a server which can't handle
+remotefilelog requests because it's http-based:
+  $ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log
+
+  $ cd ..
+  $ cat hg1.pid >> $DAEMON_PIDS
+
+  $ hgcloneshallow http://localhost:$HGPORT/ shallow -q
+  1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over 0.00s
+  abort: HTTP Error 500: Internal Server Error
+
+Bug: remotefilelog capability is listed for cmd=hello but not cmd=capabilities
+  $ get-with-headers.py localhost:$HGPORT '?cmd=capabilities'
+  200 Script output follows
+  
+  lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream-preferred stream bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 (no-eol)
+  $ get-with-headers.py localhost:$HGPORT '?cmd=hello'
+  200 Script output follows
+  
+  capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream-preferred stream bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 remotefilelog
+
+  $ get-with-headers.py localhost:$HGPORT '?cmd=this-command-does-not-exist' | head -n 1
+  400 no such method: this-command-does-not-exist
+Bug: this should return 400, not 5xx
+  $ get-with-headers.py localhost:$HGPORT '?cmd=getfiles' | head -n 1
+  500 Internal Server Error


More information about the Mercurial-devel mailing list