Patchwork D12059: test-http-bad-server: move on test from bytes-count to pattern

login
register
mail settings
Submitter phabricator
Date Jan. 24, 2022, 2:48 p.m.
Message ID <differential-rev-PHID-DREV-xst7ummguc42rhl7ueyu-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50385/
State New
Headers show

Comments

phabricator - Jan. 24, 2022, 2:48 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12059

AFFECTED FILES
  tests/test-http-bad-server.t

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t
--- a/tests/test-http-bad-server.t
+++ b/tests/test-http-bad-server.t
@@ -813,7 +813,9 @@ 
 Server sends incomplete bundle2 stream params length
 ----------------------------------------------------
 
-  $ hg serve --config badserver.close-after-send-bytes=989 -p $HGPORT -d --pid-file=hg.pid -E error.log
+  $ hg serve \
+  > --config badserver.close-after-send-patterns='4\r\n\0\0\0' \
+  > -p $HGPORT -d --pid-file=hg.pid -E error.log
   $ cat hg.pid > $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT/ clone
@@ -827,10 +829,10 @@ 
 
 #if py36
   $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -10
-  sendall(167 from 167) -> (30) 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) -> (24) 1\\r\\n\x04\\r\\n (esc)
-  sendall(9 from 9) -> (15) 4\r\nnone\r\n
-  sendall(9 from 9) -> (6) 4\r\nHG20\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(9) -> 4\r\nHG20\r\n
   sendall(6 from 9) -> (0) 4\\r\\n\x00\x00\x00 (esc)
   write limit reached; closing socket
   $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob)
@@ -841,13 +843,13 @@ 
 #else
   $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -12
   readline(~) -> (2) \r\n (py3 !)
-  write(167 from 167) -> (30) 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) -> (60) Content-Type: application/mercurial-0.2\r\n
-  write(28 from 28) -> (32) Transfer-Encoding: chunked\r\n
-  write(2 from 2) -> (30) \r\n
-  write(6 from 6) -> (24) 1\\r\\n\x04\\r\\n (esc)
-  write(9 from 9) -> (15) 4\r\nnone\r\n
-  write(9 from 9) -> (6) 4\r\nHG20\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
+  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(9) -> 4\r\nHG20\r\n
   write(6 from 9) -> (0) 4\\r\\n\x00\x00\x00 (esc)
   write limit reached; closing socket
   $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob)