# HG changeset patch # User Mads Kiilerich # Date 1679586524 -3600 # Node ID 5644f6286618217d6c4bceb6702a51cd8912a96b # Parent 80c8dcfb73c6a0d096378d685f5fc43d6c9ccf12 tests: show test-patchbomb-tls.t smtp server log Improve test coverage by exposing what the smtp server actually receives. Make dummystmtpd redirect stderr to a log file. diff -r 80c8dcfb73c6 -r 5644f6286618 tests/dummysmtpd.py --- a/tests/dummysmtpd.py Wed Jun 28 01:31:10 2023 +0200 +++ b/tests/dummysmtpd.py Thu Mar 23 16:48:44 2023 +0100 @@ -93,6 +93,7 @@ op.add_option('--pid-file', metavar='FILE') op.add_option('--tls', choices=['none', 'smtps'], default='none') op.add_option('--certificate', metavar='FILE') + op.add_option('--logfile', metavar='FILE') opts, args = op.parse_args() if opts.tls == 'smtps' and not opts.certificate: @@ -113,6 +114,7 @@ runfn=run, runargs=[pycompat.sysexecutable, pycompat.fsencode(__file__)] + pycompat.sysargv[1:], + logfile=opts.logfile, ) diff -r 80c8dcfb73c6 -r 5644f6286618 tests/test-patchbomb-tls.t --- a/tests/test-patchbomb-tls.t Wed Jun 28 01:31:10 2023 +0200 +++ b/tests/test-patchbomb-tls.t Thu Mar 23 16:48:44 2023 +0100 @@ -5,7 +5,7 @@ $ CERTSDIR="$TESTDIR/sslcerts" $ cat "$CERTSDIR/priv.pem" "$CERTSDIR/pub.pem" >> server.pem - $ "$PYTHON" "$TESTDIR/dummysmtpd.py" -p $HGPORT --pid-file a.pid -d \ + $ "$PYTHON" "$TESTDIR/dummysmtpd.py" -p $HGPORT --pid-file a.pid --logfile log -d \ > --tls smtps --certificate `pwd`/server.pem listening at localhost:$HGPORT (?) $ cat a.pid >> $DAEMON_PIDS @@ -75,6 +75,10 @@ (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] + $ cat ../log + * ssl error (glob) + $ : > ../log + With global certificates: $ try --debug --config web.cacerts="$CERTSDIR/pub.pem" @@ -86,6 +90,10 @@ (verifying remote certificate) sending [PATCH] a ... + $ cat ../log + * from=quux to=foo, bar (glob) + $ : > ../log + With invalid certificates: $ try --config web.cacerts="$CERTSDIR/pub-other.pem" @@ -96,4 +104,8 @@ (?i)abort: .*?certificate.verify.failed.* (re) [255] + $ cat ../log + * ssl error (glob) + $ : > ../log + $ cd ..