##// END OF EJS Templates
tests: consolidate test-push-http.t and test-push-http-bundle1.t...
Gregory Szorc -
r36319:47728063 stable
parent child Browse files
Show More
@@ -1,234 +1,288 b''
1 1 #require killdaemons
2 2
3 #testcases bundle1 bundle2
4
5 #if bundle1
6 $ cat << EOF >> $HGRCPATH
7 > [devel]
8 > # This test is dedicated to interaction through old bundle
9 > legacy.exchange = bundle1
10 > EOF
11 #endif
12
3 13 $ hg init test
4 14 $ cd test
5 15 $ echo a > a
6 16 $ hg ci -Ama
7 17 adding a
8 18 $ cd ..
9 19 $ hg clone test test2
10 20 updating to branch default
11 21 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12 22 $ cd test2
13 23 $ echo a >> a
14 24 $ hg ci -mb
15 25 $ req() {
16 26 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
17 27 > cat hg.pid >> $DAEMON_PIDS
18 28 > hg --cwd ../test2 push http://localhost:$HGPORT/
19 29 > exitstatus=$?
20 30 > killdaemons.py
21 31 > echo % serve errors
22 32 > cat errors.log
23 33 > return $exitstatus
24 34 > }
25 35 $ cd ../test
26 36
27 37 expect ssl error
28 38
29 39 $ req
30 40 pushing to http://localhost:$HGPORT/
31 41 searching for changes
32 42 abort: HTTP Error 403: ssl required
33 43 % serve errors
34 44 [255]
35 45
36 46 expect authorization error
37 47
38 48 $ echo '[web]' > .hg/hgrc
39 49 $ echo 'push_ssl = false' >> .hg/hgrc
40 50 $ req
41 51 pushing to http://localhost:$HGPORT/
42 52 searching for changes
43 53 abort: authorization failed
44 54 % serve errors
45 55 [255]
46 56
47 57 expect authorization error: must have authorized user
48 58
49 59 $ echo 'allow_push = unperson' >> .hg/hgrc
50 60 $ req
51 61 pushing to http://localhost:$HGPORT/
52 62 searching for changes
53 63 abort: authorization failed
54 64 % serve errors
55 65 [255]
56 66
57 67 expect success
58 68
59 69 $ cat > $TESTTMP/hook.sh <<'EOF'
60 70 > echo "phase-move: $HG_NODE: $HG_OLDPHASE -> $HG_PHASE"
61 71 > EOF
62 72
63 73 $ cat >> .hg/hgrc <<EOF
64 74 > allow_push = *
65 75 > [hooks]
66 76 > changegroup = sh -c "printenv.py changegroup 0"
67 77 > pushkey = sh -c "printenv.py pushkey 0"
68 78 > txnclose-phase.test = sh $TESTTMP/hook.sh
69 79 > EOF
70 80 $ req
71 81 pushing to http://localhost:$HGPORT/
72 82 searching for changes
73 83 remote: adding changesets
74 84 remote: adding manifests
75 85 remote: adding file changes
76 86 remote: added 1 changesets with 1 changes to 1 files
77 87 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
78 88 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
79 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
89 remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) (bundle1 !)
90 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) (bundle2 !)
80 91 % serve errors
81 92 $ hg rollback
82 93 repository tip rolled back to revision 0 (undo serve)
83 94
84 95 expect success, server lacks the httpheader capability
85 96
86 97 $ CAP=httpheader
87 98 $ . "$TESTDIR/notcapable"
88 99 $ req
89 100 pushing to http://localhost:$HGPORT/
90 101 searching for changes
91 102 remote: adding changesets
92 103 remote: adding manifests
93 104 remote: adding file changes
94 105 remote: added 1 changesets with 1 changes to 1 files
95 106 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
96 107 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
97 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
108 remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) (bundle1 !)
109 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) (bundle2 !)
98 110 % serve errors
99 111 $ hg rollback
100 112 repository tip rolled back to revision 0 (undo serve)
101 113
102 114 expect success, server lacks the unbundlehash capability
103 115
104 116 $ CAP=unbundlehash
105 117 $ . "$TESTDIR/notcapable"
106 118 $ req
107 119 pushing to http://localhost:$HGPORT/
108 120 searching for changes
109 121 remote: adding changesets
110 122 remote: adding manifests
111 123 remote: adding file changes
112 124 remote: added 1 changesets with 1 changes to 1 files
113 125 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
114 126 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
115 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
127 remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) (bundle1 !)
128 remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) (bundle2 !)
116 129 % serve errors
117 130 $ hg rollback
118 131 repository tip rolled back to revision 0 (undo serve)
119 132
120 133 expect success, pre-d1b16a746db6 server supports the unbundle capability, but
121 134 has no parameter
122 135
123 136 $ cat <<EOF > notcapable-unbundleparam.py
124 137 > from mercurial import extensions, httppeer
125 138 > def capable(orig, self, name):
126 139 > if name == 'unbundle':
127 140 > return True
128 141 > return orig(self, name)
129 142 > def uisetup(ui):
130 143 > extensions.wrapfunction(httppeer.httppeer, 'capable', capable)
131 144 > EOF
132 145 $ cp $HGRCPATH $HGRCPATH.orig
133 146 $ cat <<EOF >> $HGRCPATH
134 147 > [extensions]
135 148 > notcapable-unbundleparam = `pwd`/notcapable-unbundleparam.py
136 149 > EOF
137 150 $ req
138 151 pushing to http://localhost:$HGPORT/
139 152 searching for changes
140 153 remote: adding changesets
141 154 remote: adding manifests
142 155 remote: adding file changes
143 156 remote: added 1 changesets with 1 changes to 1 files
144 157 remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public
145 158 remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public
146 159 remote: changegroup hook: * (glob)
147 160 % serve errors
148 161 $ hg rollback
149 162 repository tip rolled back to revision 0 (undo serve)
150 163 $ mv $HGRCPATH.orig $HGRCPATH
151 164
152 165 expect push success, phase change failure
153 166
154 167 $ cat > .hg/hgrc <<EOF
155 168 > [web]
156 169 > push_ssl = false
157 170 > allow_push = *
158 171 > [hooks]
159 172 > prepushkey = sh -c "printenv.py prepushkey 1"
160 173 > [devel]
161 174 > legacy.exchange=phases
162 175 > EOF
176
177 #if bundle1
178
179 $ req
180 pushing to http://localhost:$HGPORT/
181 searching for changes
182 remote: adding changesets
183 remote: adding manifests
184 remote: adding file changes
185 remote: added 1 changesets with 1 changes to 1 files
186 % serve errors
187
188 #endif
189
190 #if bundle2
191
163 192 $ req
164 193 pushing to http://localhost:$HGPORT/
165 194 searching for changes
166 195 remote: adding changesets
167 196 remote: adding manifests
168 197 remote: adding file changes
169 198 remote: added 1 changesets with 1 changes to 1 files
170 199 remote: prepushkey hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NAMESPACE=phases HG_NEW=0 HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_OLD=1 HG_PENDING=$TESTTMP/test HG_PHASES_MOVED=1 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob)
171 200 remote: pushkey-abort: prepushkey hook exited with status 1
172 201 remote: transaction abort!
173 202 remote: rollback completed
174 203 abort: updating ba677d0156c1 to public failed
175 204 % serve errors
176 205 [255]
177 206
207 #endif
208
178 209 expect phase change success
179 210
180 211 $ cat >> .hg/hgrc <<EOF
212 > [hooks]
181 213 > prepushkey = sh -c "printenv.py prepushkey 0"
182 214 > [devel]
183 215 > legacy.exchange=
184 216 > EOF
217
218 #if bundle1
219
220 $ req
221 pushing to http://localhost:$HGPORT/
222 searching for changes
223 no changes found
224 % serve errors
225 [1]
226 $ hg rollback
227 repository tip rolled back to revision 0 (undo serve)
228
229 #endif
230
231 #if bundle2
232
185 233 $ req
186 234 pushing to http://localhost:$HGPORT/
187 235 searching for changes
188 236 remote: adding changesets
189 237 remote: adding manifests
190 238 remote: adding file changes
191 239 remote: added 1 changesets with 1 changes to 1 files
192 240 % serve errors
193 241 $ hg rollback
194 242 repository tip rolled back to revision 0 (undo serve)
195 243
244 #endif
245
196 246 expect authorization error: all users denied
197 247
198 248 $ echo '[web]' > .hg/hgrc
199 249 $ echo 'push_ssl = false' >> .hg/hgrc
200 250 $ echo 'deny_push = *' >> .hg/hgrc
201 251 $ req
202 252 pushing to http://localhost:$HGPORT/
203 253 searching for changes
204 254 abort: authorization failed
205 255 % serve errors
206 256 [255]
207 257
208 258 expect authorization error: some users denied, users must be authenticated
209 259
210 260 $ echo 'deny_push = unperson' >> .hg/hgrc
211 261 $ req
212 262 pushing to http://localhost:$HGPORT/
213 263 searching for changes
214 264 abort: authorization failed
215 265 % serve errors
216 266 [255]
217 267
268 #if bundle2
269
218 270 $ cat > .hg/hgrc <<EOF
219 271 > [web]
220 272 > push_ssl = false
221 273 > allow_push = *
222 274 > [experimental]
223 275 > httppostargs=true
224 276 > EOF
225 277 $ req
226 278 pushing to http://localhost:$HGPORT/
227 279 searching for changes
228 280 remote: adding changesets
229 281 remote: adding manifests
230 282 remote: adding file changes
231 283 remote: added 1 changesets with 1 changes to 1 files
232 284 % serve errors
233 285
286 #endif
287
234 288 $ cd ..
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now