# HG changeset patch # User Matt Mackall # Date 1285526601 18000 # Node ID fc12114dbaa52451fa4781ff39948534c7b8642f # Parent f5d3ff0a8192f97230845ee3c35ba8eb142a94b4 tests: unify test-http-proxy diff -r f5d3ff0a8192 -r fc12114dbaa5 tests/test-http-proxy --- a/tests/test-http-proxy Sun Sep 26 13:43:21 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -#!/bin/sh - -hg init a -cd a -echo a > a -hg ci -Ama -d '1123456789 0' -hg --config server.uncompressed=True serve -p $HGPORT -d --pid-file=hg.pid -cat hg.pid >> $DAEMON_PIDS - -cd .. -("$TESTDIR/tinyproxy.py" $HGPORT1 localhost >proxy.log 2>&1 proxy.pid) -cat proxy.pid >> $DAEMON_PIDS -sleep 2 - -echo %% url for proxy, stream -http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone --uncompressed http://localhost:$HGPORT/ b | \ - sed -e 's/[0-9][0-9.]*/XXX/g' -e 's/[KM]\(B\/sec\)/X\1/' -cd b -hg verify -cd .. - -echo %% url for proxy, pull -http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone http://localhost:$HGPORT/ b-pull -cd b-pull -hg verify -cd .. - -echo %% host:port for proxy -http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ c - -echo %% proxy url with user name and password -http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ d - -echo %% url with user name and password -http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://user:passwd@localhost:$HGPORT/ e - -echo %% bad host:port for proxy -http_proxy=localhost:$HGPORT2 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ f - -echo %% do not use the proxy if it is in the no list -http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.no=localhost http://localhost:$HGPORT/ g - -cat proxy.log | sed -e 's/^.*\] /XXX /' -e 's/:[0-9][0-9]*/:/' -exit 0 diff -r f5d3ff0a8192 -r fc12114dbaa5 tests/test-http-proxy.out --- a/tests/test-http-proxy.out Sun Sep 26 13:43:21 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -adding a -%% url for proxy, stream -streaming all changes -XXX files to transfer, XXX bytes of data -transferred XXX bytes in XXX seconds (XXX XB/sec) -updating to branch default -XXX files updated, XXX files merged, XXX files removed, XXX files unresolved -checking changesets -checking manifests -crosschecking files in changesets and manifests -checking files -1 files, 1 changesets, 1 total revisions -%% url for proxy, pull -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 1 changes to 1 files -updating to branch default -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -checking changesets -checking manifests -crosschecking files in changesets and manifests -checking files -1 files, 1 changesets, 1 total revisions -%% host:port for proxy -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 1 changes to 1 files -updating to branch default -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -%% proxy url with user name and password -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 1 changes to 1 files -updating to branch default -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -%% url with user name and password -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 1 changes to 1 files -updating to branch default -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -%% bad host:port for proxy -abort: error: Connection refused -%% do not use the proxy if it is in the no list -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 1 changes to 1 files -updating to branch default -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -XXX "GET http://localhost:/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" - - -XXX "GET http://localhost:/?cmd=capabilities HTTP/1.1" - - -XXX "GET http://localhost:/?cmd=stream_out HTTP/1.1" - - -XXX "GET http://localhost:/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" - - -XXX "GET http://localhost:/?cmd=heads HTTP/1.1" - - -XXX "GET http://localhost:/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - -XXX "GET http://localhost:/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" - - -XXX "GET http://localhost:/?cmd=heads HTTP/1.1" - - -XXX "GET http://localhost:/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - -XXX "GET http://localhost:/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" - - -XXX "GET http://localhost:/?cmd=heads HTTP/1.1" - - -XXX "GET http://localhost:/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - -XXX "GET http://localhost:/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" - - -XXX "GET http://localhost:/?cmd=heads HTTP/1.1" - - -XXX "GET http://localhost:/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - diff -r f5d3ff0a8192 -r fc12114dbaa5 tests/test-http-proxy.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-http-proxy.t Sun Sep 26 13:43:21 2010 -0500 @@ -0,0 +1,116 @@ + + $ hg init a + $ cd a + $ echo a > a + $ hg ci -Ama -d '1123456789 0' + adding a + $ hg --config server.uncompressed=True serve -p $HGPORT -d --pid-file=hg.pid + $ cat hg.pid >> $DAEMON_PIDS + $ cd .. + $ ("$TESTDIR/tinyproxy.py" $HGPORT1 localhost >proxy.log 2>&1 proxy.pid) + $ cat proxy.pid >> $DAEMON_PIDS + $ sleep 2 + +url for proxy, stream + + $ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone --uncompressed http://localhost:$HGPORT/ b + streaming all changes + 3 files to transfer, 303 bytes of data + transferred * bytes in * seconds (*B/sec) (glob) + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd b + $ hg verify + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + 1 files, 1 changesets, 1 total revisions + $ cd .. + +url for proxy, pull + + $ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone http://localhost:$HGPORT/ b-pull + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd b-pull + $ hg verify + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + 1 files, 1 changesets, 1 total revisions + $ cd .. + +host:port for proxy + + $ http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ c + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + +proxy url with user name and password + + $ http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ d + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + +url with user name and password + + $ http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://user:passwd@localhost:$HGPORT/ e + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + +bad host:port for proxy + + $ http_proxy=localhost:$HGPORT2 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ f + abort: error: Connection refused + [255] + +do not use the proxy if it is in the no list + + $ http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.no=localhost http://localhost:$HGPORT/ g + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cat proxy.log + * - - [*] "GET http://localhost:*/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" - - (glob) + * - - [*] "GET http://localhost:*/?cmd=capabilities HTTP/1.1" - - (glob) + * - - [*] "GET http://localhost:*/?cmd=stream_out HTTP/1.1" - - (glob) + * - - [*] "GET http://localhost:*/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" - - (glob) + * - - [*] "GET http://localhost:*/?cmd=heads HTTP/1.1" - - (glob) + * - - [*] "GET http://localhost:*/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) + * - - [*] "GET http://localhost:*/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" - - (glob) + * - - [*] "GET http://localhost:*/?cmd=heads HTTP/1.1" - - (glob) + * - - [*] "GET http://localhost:*/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) + * - - [*] "GET http://localhost:*/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" - - (glob) + * - - [*] "GET http://localhost:*/?cmd=heads HTTP/1.1" - - (glob) + * - - [*] "GET http://localhost:*/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) + * - - [*] "GET http://localhost:*/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" - - (glob) + * - - [*] "GET http://localhost:*/?cmd=heads HTTP/1.1" - - (glob) + * - - [*] "GET http://localhost:*/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) +