comparison tests/test-http-bad-server.t @ 48641:36a41521ed57

test-http-bad-server: use the new pattern-reading for a test-case This test case is now less sensitive to change of unrelated bits of the client/server exchange. Since this introduce some churn in the output, we do it independently for each test cases. Differential Revision: https://phab.mercurial-scm.org/D12072
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 21 Jan 2022 19:25:57 +0100
parents 316b912c47f5
children 009e86022a9d
comparison
equal deleted inserted replaced
48640:316b912c47f5 48641:36a41521ed57
156 $ rm -f error.log 156 $ rm -f error.log
157 157
158 Failure to read getbundle HTTP request 158 Failure to read getbundle HTTP request
159 -------------------------------------- 159 --------------------------------------
160 160
161 $ hg serve --config badserver.close-after-recv-bytes=308,317,304 -p $HGPORT -d --pid-file=hg.pid -E error.log 161 $ hg serve \
162 > --config badserver.close-after-recv-patterns="GET /\?cmd=batch,user-agent: mercurial/proto-1.0,GET /\?cmd=getbundle" \
163 > --config badserver.close-after-recv-bytes=110,26,274 \
164 > -p $HGPORT -d --pid-file=hg.pid -E error.log
162 $ cat hg.pid > $DAEMON_PIDS 165 $ cat hg.pid > $DAEMON_PIDS
163 $ hg clone http://localhost:$HGPORT/ clone 166 $ hg clone http://localhost:$HGPORT/ clone
164 requesting all changes 167 requesting all changes
165 abort: error: bad HTTP status line: * (glob) 168 abort: error: bad HTTP status line: * (glob)
166 [100] 169 [100]
168 $ killdaemons.py $DAEMON_PIDS 171 $ killdaemons.py $DAEMON_PIDS
169 172
170 $ cat error.log 173 $ cat error.log
171 readline(1 from -1) -> (1) x (?) 174 readline(1 from -1) -> (1) x (?)
172 readline(1 from -1) -> (1) x (?) 175 readline(1 from -1) -> (1) x (?)
173 readline(308 from ~) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n 176 readline(~) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
174 readline(275 from *) -> (27) Accept-Encoding: identity\r\n (glob) 177 readline(*) -> (27) Accept-Encoding: identity\r\n (glob)
175 readline(248 from *) -> (35) accept: application/mercurial-0.1\r\n (glob) 178 readline(*) -> (35) accept: application/mercurial-0.1\r\n (glob)
176 readline(213 from *) -> (*) host: localhost:$HGPORT\r\n (glob) 179 readline(*) -> (*) host: localhost:$HGPORT\r\n (glob)
177 readline(* from *) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) 180 readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob)
178 readline(* from *) -> (2) \r\n (glob) 181 readline(*) -> (2) \r\n (glob)
179 sendall(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) 182 sendall(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !)
180 sendall(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !) 183 sendall(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !)
181 write(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) 184 write(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !)
182 write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py3 no-py36 !) 185 write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py3 no-py36 !)
183 write(36) -> HTTP/1.1 200 Script output follows\r\n (no-py3 !) 186 write(36) -> HTTP/1.1 200 Script output follows\r\n (no-py3 !)
185 write(37) -> Date: $HTTP_DATE$\r\n (no-py3 !) 188 write(37) -> Date: $HTTP_DATE$\r\n (no-py3 !)
186 write(41) -> Content-Type: application/mercurial-0.1\r\n (no-py3 !) 189 write(41) -> Content-Type: application/mercurial-0.1\r\n (no-py3 !)
187 write(21) -> Content-Length: 431\r\n (no-py3 !) 190 write(21) -> Content-Length: 431\r\n (no-py3 !)
188 write(2) -> \r\n (no-py3 !) 191 write(2) -> \r\n (no-py3 !)
189 write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) 192 write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !)
190 readline(13? from ~) -> (26) GET /?cmd=batch HTTP/1.1\r\n (glob) 193 readline(~) -> (26) GET /?cmd=batch HTTP/1.1\r\n (glob)
191 readline(1?? from *) -> (27) Accept-Encoding: identity\r\n (glob) 194 readline(*) -> (27) Accept-Encoding: identity\r\n (glob)
192 readline(8? from *) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) 195 readline(*) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob)
193 readline(5? from *) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n (glob) 196 readline(*) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n (glob)
194 readline(1? from *) -> (1?) x-hgproto-1:* (glob) 197 readline(*) -> (1?) x-hgproto-1:* (glob)
195 read limit reached; closing socket 198 read limit reached; closing socket
196 readline(317 from ~) -> (26) GET /?cmd=batch HTTP/1.1\r\n 199 readline(~) -> (26) GET /?cmd=batch HTTP/1.1\r\n
197 readline(291 from *) -> (27) Accept-Encoding: identity\r\n (glob) 200 readline(*) -> (27) Accept-Encoding: identity\r\n (glob)
198 readline(264 from *) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) 201 readline(*) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob)
199 readline(235 from *) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n (glob) 202 readline(*) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n (glob)
200 readline(194 from *) -> (61) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n (glob) 203 readline(*) -> (61) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n (glob)
201 readline(133 from *) -> (35) accept: application/mercurial-0.1\r\n (glob) 204 readline(*) -> (35) accept: application/mercurial-0.1\r\n (glob)
202 readline(98 from *) -> (*) host: localhost:$HGPORT\r\n (glob) 205 readline(*) -> (*) host: localhost:$HGPORT\r\n (glob)
203 readline(* from *) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) 206 readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob)
204 readline(* from *) -> (2) \r\n (glob) 207 readline(*) -> (2) \r\n (glob)
205 sendall(159) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 42\r\n\r\n (py36 !) 208 sendall(159) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 42\r\n\r\n (py36 !)
206 sendall(42) -> 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n; (py36 !) 209 sendall(42) -> 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n; (py36 !)
207 write(159) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 42\r\n\r\n (py3 no-py36 !) 210 write(159) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 42\r\n\r\n (py3 no-py36 !)
208 write(42) -> 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n; (py3 no-py36 !) 211 write(42) -> 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n; (py3 no-py36 !)
209 write(36) -> HTTP/1.1 200 Script output follows\r\n (no-py3 !) 212 write(36) -> HTTP/1.1 200 Script output follows\r\n (no-py3 !)
211 write(37) -> Date: $HTTP_DATE$\r\n (no-py3 !) 214 write(37) -> Date: $HTTP_DATE$\r\n (no-py3 !)
212 write(41) -> Content-Type: application/mercurial-0.1\r\n (no-py3 !) 215 write(41) -> Content-Type: application/mercurial-0.1\r\n (no-py3 !)
213 write(20) -> Content-Length: 42\r\n (no-py3 !) 216 write(20) -> Content-Length: 42\r\n (no-py3 !)
214 write(2) -> \r\n (no-py3 !) 217 write(2) -> \r\n (no-py3 !)
215 write(42) -> 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n; (no-py3 !) 218 write(42) -> 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n; (no-py3 !)
216 readline(* from ~) -> (*) GET /?cmd=getbundle HTTP* (glob) 219 readline(24 from ~) -> (*) GET /?cmd=getbundle HTTP* (glob)
217 read limit reached; closing socket 220 read limit reached; closing socket
218 readline(304 from ~) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n 221 readline(~) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n
219 readline(274 from *) -> (27) Accept-Encoding: identity\r\n (glob) 222 readline(274 from *) -> (27) Accept-Encoding: identity\r\n (glob)
220 readline(247 from *) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) 223 readline(247 from *) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob)
221 readline(218 from *) -> (218) x-hgarg-1: bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtag (glob) 224 readline(218 from *) -> (218) x-hgarg-1: bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtag (glob)
222 read limit reached; closing socket 225 read limit reached; closing socket
223 226