# HG changeset patch # User Matt Mackall # Date 2010-09-26 18:43:21 # Node ID fc12114dbaa52451fa4781ff39948534c7b8642f # Parent f5d3ff0a8192f97230845ee3c35ba8eb142a94b4 tests: unify test-http-proxy diff --git a/tests/test-http-proxy.out b/tests/test-http-proxy.out deleted file mode 100644 --- a/tests/test-http-proxy.out +++ /dev/null @@ -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 --git a/tests/test-http-proxy b/tests/test-http-proxy.t old mode 100755 new mode 100644 rename from tests/test-http-proxy rename to tests/test-http-proxy.t --- a/tests/test-http-proxy +++ b/tests/test-http-proxy.t @@ -1,45 +1,116 @@ -#!/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 + $ 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 -cd .. -("$TESTDIR/tinyproxy.py" $HGPORT1 localhost >proxy.log 2>&1 proxy.pid) -cat proxy.pid >> $DAEMON_PIDS -sleep 2 + $ 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 -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 .. + $ 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 -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 .. + $ 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 -echo %% host:port for proxy -http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ c + $ 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 -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 +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 -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 +bad host:port for proxy -echo %% bad host:port for proxy -http_proxy=localhost:$HGPORT2 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ f + $ 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 -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 + $ 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) -cat proxy.log | sed -e 's/^.*\] /XXX /' -e 's/:[0-9][0-9]*/:/' -exit 0