comparison tests/test-patchbomb-tls.t @ 50729:5644f6286618 stable

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.
author Mads Kiilerich <mads@kiilerich.com>
date Thu, 23 Mar 2023 16:48:44 +0100
parents 8f50dc096cf4
children cfb6ca77e6bc
comparison
equal deleted inserted replaced
50728:80c8dcfb73c6 50729:5644f6286618
3 Set up SMTP server: 3 Set up SMTP server:
4 4
5 $ CERTSDIR="$TESTDIR/sslcerts" 5 $ CERTSDIR="$TESTDIR/sslcerts"
6 $ cat "$CERTSDIR/priv.pem" "$CERTSDIR/pub.pem" >> server.pem 6 $ cat "$CERTSDIR/priv.pem" "$CERTSDIR/pub.pem" >> server.pem
7 7
8 $ "$PYTHON" "$TESTDIR/dummysmtpd.py" -p $HGPORT --pid-file a.pid -d \ 8 $ "$PYTHON" "$TESTDIR/dummysmtpd.py" -p $HGPORT --pid-file a.pid --logfile log -d \
9 > --tls smtps --certificate `pwd`/server.pem 9 > --tls smtps --certificate `pwd`/server.pem
10 listening at localhost:$HGPORT (?) 10 listening at localhost:$HGPORT (?)
11 $ cat a.pid >> $DAEMON_PIDS 11 $ cat a.pid >> $DAEMON_PIDS
12 12
13 Set up repository: 13 Set up repository:
73 (verifying remote certificate) 73 (verifying remote certificate)
74 abort: unable to verify security of localhost (no loaded CA certificates); refusing to connect 74 abort: unable to verify security of localhost (no loaded CA certificates); refusing to connect
75 (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) 75 (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)
76 [150] 76 [150]
77 77
78 $ cat ../log
79 * ssl error (glob)
80 $ : > ../log
81
78 With global certificates: 82 With global certificates:
79 83
80 $ try --debug --config web.cacerts="$CERTSDIR/pub.pem" 84 $ try --debug --config web.cacerts="$CERTSDIR/pub.pem"
81 this patch series consists of 1 patches. 85 this patch series consists of 1 patches.
82 86
84 (using smtps) 88 (using smtps)
85 sending mail: smtp host localhost, port * (glob) 89 sending mail: smtp host localhost, port * (glob)
86 (verifying remote certificate) 90 (verifying remote certificate)
87 sending [PATCH] a ... 91 sending [PATCH] a ...
88 92
93 $ cat ../log
94 * from=quux to=foo, bar (glob)
95 $ : > ../log
96
89 With invalid certificates: 97 With invalid certificates:
90 98
91 $ try --config web.cacerts="$CERTSDIR/pub-other.pem" 99 $ try --config web.cacerts="$CERTSDIR/pub-other.pem"
92 this patch series consists of 1 patches. 100 this patch series consists of 1 patches.
93 101
94 102
95 (the full certificate chain may not be available locally; see "hg help debugssl") (windows !) 103 (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
96 (?i)abort: .*?certificate.verify.failed.* (re) 104 (?i)abort: .*?certificate.verify.failed.* (re)
97 [255] 105 [255]
98 106
107 $ cat ../log
108 * ssl error (glob)
109 $ : > ../log
110
99 $ cd .. 111 $ cd ..