changeset 51498:25055932042a stable

tests: fix test-patchbomb-tls.t instability The flakiness on chg is caused by a client that exit faster than the server output log. So actively wait for the server to issue the expected output (with a small timeout)
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 11 Mar 2024 12:03:40 +0100
parents 9da3fcc5f70f
children 8b77ad54d67a
files tests/test-patchbomb-tls.t
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-patchbomb-tls.t	Mon Mar 11 16:05:28 2024 +0100
+++ b/tests/test-patchbomb-tls.t	Mon Mar 11 12:03:40 2024 +0100
@@ -1,5 +1,15 @@
 #require serve ssl
 
+  $ wait_log() {
+  >     pattern="$1"
+  >     for s in $TESTDIR/seq.py 10; do
+  >         if grep "$pattern" $TESTTMP/log > /dev/null ; then
+  >             break
+  >         fi
+  >         sleep 1
+  >     done
+  > }
+
 Set up SMTP server:
 
   $ CERTSDIR="$TESTDIR/sslcerts"
@@ -47,6 +57,7 @@
   (?i)abort: .*?certificate.verify.failed.* (re)
   [255]
 
+  $ wait_log "ssl error:"
   $ cat ../log
   * ssl error: * (glob)
   $ : > ../log
@@ -62,6 +73,7 @@
   (?i)abort: .*?certificate.verify.failed.* (re)
   [255]
 
+  $ wait_log "ssl error:"
   $ cat ../log
   * ssl error: * (glob)
   $ : > ../log
@@ -83,6 +95,7 @@
   (see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error or set hostsecurity.localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e to trust this server)
   [150]
 
+  $ wait_log "no hello:"
   $ cat ../log
   connection from * (glob)
   no hello: b''
@@ -143,6 +156,7 @@
   (?i)abort: .*?certificate.verify.failed.* (re)
   [255]
 
+  $ wait_log "ssl error:"
   $ cat ../log
   * ssl error: * (glob)
   $ : > ../log