Mercurial > hg
comparison tests/test-push-http-bundle1.t @ 25389:d6389553b6a1
test: copy test-push-http.t to testpush-http-bundle1.t
We want to keep both code paths tested. The test is a bit too extensive to
simply introduce dual testing in it, so we make a copy for each protocol
version.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 27 May 2015 12:54:51 -0700 |
parents | tests/test-push-http.t@d283517b260b |
children | 4d2b9b304ad0 |
comparison
equal
deleted
inserted
replaced
25388:6025cac3d02f | 25389:d6389553b6a1 |
---|---|
1 #require killdaemons | |
2 | |
3 This test checks behavior related to bundle1 that changed or is likely | |
4 to change with bundle2. Feel free to factor out any part of the test | |
5 which does not need to exist to keep bundle1 working. | |
6 | |
7 $ cat << EOF >> $HGRCPATH | |
8 > [experimental] | |
9 > # This test is dedicated to interaction through old bundle | |
10 > bundle2-exp = False | |
11 > EOF | |
12 | |
13 $ hg init test | |
14 $ cd test | |
15 $ echo a > a | |
16 $ hg ci -Ama | |
17 adding a | |
18 $ cd .. | |
19 $ hg clone test test2 | |
20 updating to branch default | |
21 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
22 $ cd test2 | |
23 $ echo a >> a | |
24 $ hg ci -mb | |
25 $ req() { | |
26 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log | |
27 > cat hg.pid >> $DAEMON_PIDS | |
28 > hg --cwd ../test2 push http://localhost:$HGPORT/ | |
29 > exitstatus=$? | |
30 > "$TESTDIR/killdaemons.py" $DAEMON_PIDS | |
31 > echo % serve errors | |
32 > cat errors.log | |
33 > return $exitstatus | |
34 > } | |
35 $ cd ../test | |
36 | |
37 expect ssl error | |
38 | |
39 $ req | |
40 pushing to http://localhost:$HGPORT/ | |
41 searching for changes | |
42 abort: HTTP Error 403: ssl required | |
43 % serve errors | |
44 [255] | |
45 | |
46 expect authorization error | |
47 | |
48 $ echo '[web]' > .hg/hgrc | |
49 $ echo 'push_ssl = false' >> .hg/hgrc | |
50 $ req | |
51 pushing to http://localhost:$HGPORT/ | |
52 searching for changes | |
53 abort: authorization failed | |
54 % serve errors | |
55 [255] | |
56 | |
57 expect authorization error: must have authorized user | |
58 | |
59 $ echo 'allow_push = unperson' >> .hg/hgrc | |
60 $ req | |
61 pushing to http://localhost:$HGPORT/ | |
62 searching for changes | |
63 abort: authorization failed | |
64 % serve errors | |
65 [255] | |
66 | |
67 expect success | |
68 | |
69 $ echo 'allow_push = *' >> .hg/hgrc | |
70 $ echo '[hooks]' >> .hg/hgrc | |
71 $ echo "changegroup = python \"$TESTDIR/printenv.py\" changegroup 0" >> .hg/hgrc | |
72 $ echo "pushkey = python \"$TESTDIR/printenv.py\" pushkey 0" >> .hg/hgrc | |
73 $ req | |
74 pushing to http://localhost:$HGPORT/ | |
75 searching for changes | |
76 remote: adding changesets | |
77 remote: adding manifests | |
78 remote: adding file changes | |
79 remote: added 1 changesets with 1 changes to 1 files | |
80 remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:* HG_URL=remote:http:127.0.0.1: (glob) | |
81 % serve errors | |
82 $ hg rollback | |
83 repository tip rolled back to revision 0 (undo serve) | |
84 | |
85 expect success, server lacks the httpheader capability | |
86 | |
87 $ CAP=httpheader | |
88 $ . "$TESTDIR/notcapable" | |
89 $ req | |
90 pushing to http://localhost:$HGPORT/ | |
91 searching for changes | |
92 remote: adding changesets | |
93 remote: adding manifests | |
94 remote: adding file changes | |
95 remote: added 1 changesets with 1 changes to 1 files | |
96 remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:* HG_URL=remote:http:127.0.0.1: (glob) | |
97 % serve errors | |
98 $ hg rollback | |
99 repository tip rolled back to revision 0 (undo serve) | |
100 | |
101 expect success, server lacks the unbundlehash capability | |
102 | |
103 $ CAP=unbundlehash | |
104 $ . "$TESTDIR/notcapable" | |
105 $ req | |
106 pushing to http://localhost:$HGPORT/ | |
107 searching for changes | |
108 remote: adding changesets | |
109 remote: adding manifests | |
110 remote: adding file changes | |
111 remote: added 1 changesets with 1 changes to 1 files | |
112 remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:* HG_URL=remote:http:127.0.0.1: (glob) | |
113 % serve errors | |
114 $ hg rollback | |
115 repository tip rolled back to revision 0 (undo serve) | |
116 | |
117 expect push success, phase change failure | |
118 | |
119 $ cat > .hg/hgrc <<EOF | |
120 > [web] | |
121 > push_ssl = false | |
122 > allow_push = * | |
123 > [hooks] | |
124 > prepushkey = python "$TESTDIR/printenv.py" prepushkey 1 | |
125 > EOF | |
126 $ req | |
127 pushing to http://localhost:$HGPORT/ | |
128 searching for changes | |
129 remote: adding changesets | |
130 remote: adding manifests | |
131 remote: adding file changes | |
132 remote: added 1 changesets with 1 changes to 1 files | |
133 % serve errors | |
134 | |
135 expect phase change success | |
136 | |
137 $ echo "prepushkey = python \"$TESTDIR/printenv.py\" prepushkey 0" >> .hg/hgrc | |
138 $ req | |
139 pushing to http://localhost:$HGPORT/ | |
140 searching for changes | |
141 no changes found | |
142 % serve errors | |
143 [1] | |
144 $ hg rollback | |
145 repository tip rolled back to revision 0 (undo serve) | |
146 | |
147 expect authorization error: all users denied | |
148 | |
149 $ echo '[web]' > .hg/hgrc | |
150 $ echo 'push_ssl = false' >> .hg/hgrc | |
151 $ echo 'deny_push = *' >> .hg/hgrc | |
152 $ req | |
153 pushing to http://localhost:$HGPORT/ | |
154 searching for changes | |
155 abort: authorization failed | |
156 % serve errors | |
157 [255] | |
158 | |
159 expect authorization error: some users denied, users must be authenticated | |
160 | |
161 $ echo 'deny_push = unperson' >> .hg/hgrc | |
162 $ req | |
163 pushing to http://localhost:$HGPORT/ | |
164 searching for changes | |
165 abort: authorization failed | |
166 % serve errors | |
167 [255] | |
168 | |
169 $ cd .. |