tests/test-push-http.t
author Steven Brown <StevenGBrown@gmail.com>
Mon, 25 Apr 2011 18:00:30 +0800
changeset 14011 b69471bdb678
parent 13946 3c2f9f611ef6
child 14093 ce99d887585f
permissions -rw-r--r--
tests: add script to disable a selected wire protocol capability This can be used to test that the client and server both fall back to the previous wire protocol when the capability is not supported. It is currently used by test-push-http.t and I plan to use it for the HTTP long argument support tests.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2481
5c65b4e51610 add tests for push over http.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     1
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
     2
  $ hg init test
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
     3
  $ cd test
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
     4
  $ echo a > a
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
     5
  $ hg ci -Ama
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
     6
  adding a
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
     7
  $ cd ..
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
     8
  $ hg clone test test2
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
     9
  updating to branch default
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    10
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    11
  $ cd test2
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    12
  $ echo a >> a
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    13
  $ hg ci -mb
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    14
  $ req() {
12743
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12643
diff changeset
    15
  >     hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12643
diff changeset
    16
  >     cat hg.pid >> $DAEMON_PIDS
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12643
diff changeset
    17
  >     hg --cwd ../test2 push http://localhost:$HGPORT/
13449
8b1125eb361e test-push-http: use killdaemons.py instead of kill to avoid test unreliability
Gilles Moris <gilles.moris@free.fr>
parents: 13446
diff changeset
    18
  >     "$TESTDIR/killdaemons.py"
12743
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12643
diff changeset
    19
  >     echo % serve errors
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12643
diff changeset
    20
  >     cat errors.log
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    21
  > }
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    22
  $ cd ../test
2481
5c65b4e51610 add tests for push over http.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    23
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    24
expect ssl error
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    25
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    26
  $ req
12643
d08bb64888bc tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12483
diff changeset
    27
  pushing to http://localhost:$HGPORT/
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    28
  searching for changes
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    29
  remote: ssl required
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    30
  % serve errors
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    31
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    32
expect authorization error
6167
f53b9a383476 tests: easier hg serve error diagnosis
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5386
diff changeset
    33
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    34
  $ echo '[web]' > .hg/hgrc
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    35
  $ echo 'push_ssl = false' >> .hg/hgrc
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    36
  $ req
12643
d08bb64888bc tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12483
diff changeset
    37
  pushing to http://localhost:$HGPORT/
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    38
  searching for changes
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    39
  abort: authorization failed
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    40
  % serve errors
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    41
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    42
expect authorization error: must have authorized user
2481
5c65b4e51610 add tests for push over http.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    43
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    44
  $ echo 'allow_push = unperson' >> .hg/hgrc
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    45
  $ req
12643
d08bb64888bc tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12483
diff changeset
    46
  pushing to http://localhost:$HGPORT/
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    47
  searching for changes
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    48
  abort: authorization failed
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    49
  % serve errors
2481
5c65b4e51610 add tests for push over http.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    50
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    51
expect success
2481
5c65b4e51610 add tests for push over http.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    52
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    53
  $ echo 'allow_push = *' >> .hg/hgrc
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    54
  $ echo '[hooks]' >> .hg/hgrc
13405
682edefe7dbb tests: use printenv.py where it is - don't copy it around
Mads Kiilerich <mads@kiilerich.com>
parents: 13404
diff changeset
    55
  $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup 0' >> .hg/hgrc
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    56
  $ req
12643
d08bb64888bc tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12483
diff changeset
    57
  pushing to http://localhost:$HGPORT/
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    58
  searching for changes
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    59
  remote: adding changesets
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    60
  remote: adding manifests
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    61
  remote: adding file changes
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    62
  remote: added 1 changesets with 1 changes to 1 files
13404
31a256ffe9e5 tests: let printenv.py show the real values
Mads Kiilerich <mads@kiilerich.com>
parents: 12743
diff changeset
    63
  remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http:*:  (glob)
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    64
  % serve errors
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    65
  $ hg rollback
13446
1e497df514e2 rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents: 13405
diff changeset
    66
  repository tip rolled back to revision 0 (undo serve)
1e497df514e2 rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents: 13405
diff changeset
    67
  working directory now based on revision 0
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    68
13946
3c2f9f611ef6 tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents: 13449
diff changeset
    69
expect success, server lacks the unbundlehash capability
3c2f9f611ef6 tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents: 13449
diff changeset
    70
14011
b69471bdb678 tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents: 13946
diff changeset
    71
  $ CAP=unbundlehash
b69471bdb678 tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents: 13946
diff changeset
    72
  $ . "$TESTDIR/notcapable"
13946
3c2f9f611ef6 tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents: 13449
diff changeset
    73
  $ req
3c2f9f611ef6 tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents: 13449
diff changeset
    74
  pushing to http://localhost:$HGPORT/
3c2f9f611ef6 tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents: 13449
diff changeset
    75
  searching for changes
3c2f9f611ef6 tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents: 13449
diff changeset
    76
  remote: adding changesets
3c2f9f611ef6 tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents: 13449
diff changeset
    77
  remote: adding manifests
3c2f9f611ef6 tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents: 13449
diff changeset
    78
  remote: adding file changes
3c2f9f611ef6 tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents: 13449
diff changeset
    79
  remote: added 1 changesets with 1 changes to 1 files
3c2f9f611ef6 tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents: 13449
diff changeset
    80
  remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http:*:  (glob)
3c2f9f611ef6 tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents: 13449
diff changeset
    81
  % serve errors
3c2f9f611ef6 tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents: 13449
diff changeset
    82
  $ hg rollback
3c2f9f611ef6 tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents: 13449
diff changeset
    83
  repository tip rolled back to revision 0 (undo serve)
3c2f9f611ef6 tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents: 13449
diff changeset
    84
  working directory now based on revision 0
3c2f9f611ef6 tests: new test cases for the unbundlehash capability
Steven Brown <StevenGBrown@gmail.com>
parents: 13449
diff changeset
    85
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    86
expect authorization error: all users denied
2481
5c65b4e51610 add tests for push over http.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    87
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    88
  $ echo '[web]' > .hg/hgrc
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    89
  $ echo 'push_ssl = false' >> .hg/hgrc
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    90
  $ echo 'deny_push = *' >> .hg/hgrc
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    91
  $ req
12643
d08bb64888bc tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12483
diff changeset
    92
  pushing to http://localhost:$HGPORT/
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    93
  searching for changes
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    94
  abort: authorization failed
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    95
  % serve errors
2481
5c65b4e51610 add tests for push over http.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    96
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    97
expect authorization error: some users denied, users must be authenticated
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    98
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    99
  $ echo 'deny_push = unperson' >> .hg/hgrc
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
   100
  $ req
12643
d08bb64888bc tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12483
diff changeset
   101
  pushing to http://localhost:$HGPORT/
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
   102
  searching for changes
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
   103
  abort: authorization failed
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
   104
  % serve errors