tests/test-push-http.t
author Matt Mackall <mpm@selenic.com>
Sun, 26 Sep 2010 13:44:49 -0500
changeset 12483 fecd4966f8d4
parent 11469 tests/test-push-http@c37f35d7f2f5
child 12643 d08bb64888bc
permissions -rw-r--r--
tests: unify test-push-http
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
  $ cp "$TESTDIR"/printenv.py .
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
     3
  $ hg init test
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
     4
  $ cd test
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
     5
  $ echo a > a
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
     6
  $ hg ci -Ama
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
     7
  adding a
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
     8
  $ cd ..
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
     9
  $ hg clone test test2
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    10
  updating to branch default
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    11
  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
    12
  $ cd test2
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    13
  $ echo a >> a
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    14
  $ hg ci -mb
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    15
  $ req() {
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    16
  > 	hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    17
  > 	cat hg.pid >> $DAEMON_PIDS
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    18
  > 	hg --cwd ../test2 push http://localhost:$HGPORT/
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    19
  > 	kill `cat hg.pid`
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    20
  > 	echo % serve errors
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    21
  > 	cat errors.log
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    22
  > }
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    23
  $ cd ../test
2481
5c65b4e51610 add tests for push over http.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    24
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    25
expect ssl error
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    26
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    27
  $ req
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    28
  pushing to http://localhost:*/ (glob)
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    29
  searching for changes
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    30
  remote: ssl required
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    31
  % serve errors
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    32
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    33
expect authorization error
6167
f53b9a383476 tests: easier hg serve error diagnosis
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5386
diff changeset
    34
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    35
  $ echo '[web]' > .hg/hgrc
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    36
  $ echo 'push_ssl = false' >> .hg/hgrc
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    37
  $ req
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    38
  pushing to http://localhost:*/ (glob)
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    39
  searching for changes
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    40
  abort: authorization failed
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    41
  % serve errors
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    42
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    43
expect authorization error: must have authorized user
2481
5c65b4e51610 add tests for push over http.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    44
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    45
  $ echo 'allow_push = unperson' >> .hg/hgrc
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    46
  $ req
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    47
  pushing to http://localhost:*/ (glob)
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    48
  searching for changes
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    49
  abort: authorization failed
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    50
  % serve errors
2481
5c65b4e51610 add tests for push over http.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    51
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    52
expect success
2481
5c65b4e51610 add tests for push over http.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    53
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    54
  $ echo 'allow_push = *' >> .hg/hgrc
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    55
  $ echo '[hooks]' >> .hg/hgrc
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    56
  $ echo 'changegroup = python ../printenv.py changegroup 0' >> .hg/hgrc
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    57
  $ req
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    58
  pushing to http://localhost:*/ (glob)
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    59
  searching for changes
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    60
  remote: adding changesets
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    61
  remote: adding manifests
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    62
  remote: adding file changes
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    63
  remote: added 1 changesets with 1 changes to 1 files
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    64
  remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http 
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    65
  % serve errors
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    66
  $ hg rollback
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    67
  rolling back to revision 0 (undo serve)
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    68
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    69
expect authorization error: all users denied
2481
5c65b4e51610 add tests for push over http.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    70
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    71
  $ echo '[web]' > .hg/hgrc
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    72
  $ echo 'push_ssl = false' >> .hg/hgrc
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    73
  $ echo 'deny_push = *' >> .hg/hgrc
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    74
  $ req
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    75
  pushing to http://localhost:*/ (glob)
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    76
  searching for changes
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    77
  abort: authorization failed
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    78
  % serve errors
2481
5c65b4e51610 add tests for push over http.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    79
12483
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    80
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
    81
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    82
  $ echo 'deny_push = unperson' >> .hg/hgrc
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    83
  $ req
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    84
  pushing to http://localhost:*/ (glob)
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    85
  searching for changes
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    86
  abort: authorization failed
fecd4966f8d4 tests: unify test-push-http
Matt Mackall <mpm@selenic.com>
parents: 11469
diff changeset
    87
  % serve errors