test-http-bad-server: move on test from bytes-count to pattern
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 21 Jan 2022 16:23:44 +0100
changeset 48627 26105e9b0487
parent 48626 62f1c8588fcc
child 48628 ea2f4f4e464e
test-http-bad-server: move on test from bytes-count to pattern This specific test case is now using the new "close when a pattern is seen" approach compared to the more fragile "that many bytes were sent" approach. Since such change are still a bit noisy, we split each change in there own changesets. Differential Revision: https://phab.mercurial-scm.org/D12058
tests/test-http-bad-server.t
--- a/tests/test-http-bad-server.t	Fri Jan 21 16:22:10 2022 +0100
+++ b/tests/test-http-bad-server.t	Fri Jan 21 16:23:44 2022 +0100
@@ -765,7 +765,9 @@
 Server sends partial bundle2 header magic
 -----------------------------------------
 
-  $ hg serve --config badserver.close-after-send-bytes=980 -p $HGPORT -d --pid-file=hg.pid -E error.log
+  $ hg serve \
+  > --config badserver.close-after-send-patterns='4\r\nHG2' \
+  > -p $HGPORT -d --pid-file=hg.pid -E error.log
   $ cat hg.pid > $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT/ clone
@@ -779,9 +781,9 @@
 
 #if py36
   $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -9
-  sendall(167 from 167) -> (21) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n
-  sendall(6 from 6) -> (15) 1\\r\\n\x04\\r\\n (esc)
-  sendall(9 from 9) -> (6) 4\r\nnone\r\n
+  sendall(167) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n
+  sendall(6) -> 1\\r\\n\x04\\r\\n (esc)
+  sendall(9) -> 4\r\nnone\r\n
   sendall(6 from 9) -> (0) 4\r\nHG2
   write limit reached; closing socket
   $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob)
@@ -792,12 +794,12 @@
 #else
   $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -11
   readline(~) -> (2) \r\n (py3 !)
-  write(167 from 167) -> (21) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n (py3 !)
-  write(41 from 41) -> (51) Content-Type: application/mercurial-0.2\r\n
-  write(28 from 28) -> (23) Transfer-Encoding: chunked\r\n
-  write(2 from 2) -> (21) \r\n
-  write(6 from 6) -> (15) 1\\r\\n\x04\\r\\n (esc)
-  write(9 from 9) -> (6) 4\r\nnone\r\n
+  write(167) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n (py3 !)
+  write(41) -> Content-Type: application/mercurial-0.2\r\n (no-py3 !)
+  write(28) -> Transfer-Encoding: chunked\r\n (no-py3 !)
+  write(2) -> \r\n (no-py3 !)
+  write(6) -> 1\\r\\n\x04\\r\\n (esc)
+  write(9) -> 4\r\nnone\r\n
   write(6 from 9) -> (0) 4\r\nHG2
   write limit reached; closing socket
   $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob)