test-http-bad-server: use the new pattern-reading for a test-case
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 23 Jan 2022 19:51:00 +0100
changeset 48660 1ae83cafaa39
parent 48659 5154f2025d8a
child 48661 ebd515d129c6
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/D12069
tests/test-http-bad-server.t
--- a/tests/test-http-bad-server.t	Sun Jan 23 19:49:42 2022 +0100
+++ b/tests/test-http-bad-server.t	Sun Jan 23 19:51:00 2022 +0100
@@ -91,7 +91,10 @@
 Same failure, but server reads full HTTP request line
 -----------------------------------------------------
 
-  $ hg serve --config badserver.close-after-recv-bytes=40 -p $HGPORT -d --pid-file=hg.pid -E error.log
+  $ hg serve \
+  > --config badserver.close-after-recv-patterns="GET /\?cmd=capabilities" \
+  > --config badserver.close-after-recv-bytes=7 \
+  > -p $HGPORT -d --pid-file=hg.pid -E error.log
   $ cat hg.pid > $DAEMON_PIDS
   $ hg clone http://localhost:$HGPORT/ clone
   abort: error: bad HTTP status line: * (glob)
@@ -100,7 +103,7 @@
   $ killdaemons.py $DAEMON_PIDS
 
   $ cat error.log
-  readline(40 from ~) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
+  readline(~) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
   readline(7 from *) -> (7) Accept- (glob)
   read limit reached; closing socket