Is it possible to do these things in a test?

27 views
Skip to first unread message

Geoff Lankow

unread,
Aug 17, 2021, 7:34:16 PM8/17/21
to dev-pl...@mozilla.org

Hi all, I'm trying to bolster the tests of some Thunderbird features. There's a few things I'd like to be able to do but I'm not sure they're possible in the test environment (mochi and/or xpcshell tests).
  • Check that Thunderbird looks up DNS records for a particular domain. I'd need to be able to give specific records (probably constructed during the test) for specific domains.
  • Serve files over https at specific magic paths (e.g. /well-known/carddav). I know I can serve files using the test servers (mochi.test etc.) but I don't know if I can use the paths required. Or I could create my own HTTP server but I don't think I can have that serve https requests.
  • Test mail servers with TLS. We have test servers but they always use unencrypted connections. I think if it was possible to connect to the server via SSLTunnel that would work (mail protocols really aren't my area). Is it possible?
Can you help me with one or more of these things?

Dave Townsend

unread,
Aug 18, 2021, 3:33:00 AM8/18/21
to Geoff Lankow, dev-pl...@mozilla.org
On Wed, 18 Aug 2021 at 00:34, Geoff Lankow <geoff....@gmail.com> wrote:

Hi all, I'm trying to bolster the tests of some Thunderbird features. There's a few things I'd like to be able to do but I'm not sure they're possible in the test environment (mochi and/or xpcshell tests).
  • Check that Thunderbird looks up DNS records for a particular domain. I'd need to be able to give specific records (probably constructed during the test) for specific domains.
There appears to be an observer notification sent during DNS resolution, maybe that would help: https://searchfox.org/mozilla-central/source/netwerk/dns/nsDNSService2.cpp#594.
  • Serve files over https at specific magic paths (e.g. /well-known/carddav). I know I can serve files using the test servers (mochi.test etc.) but I don't know if I can use the paths required. Or I could create my own HTTP server but I don't think I can have that serve https requests.
This is straightforward in xpcshell tests as you can easily configure what the test http server serves. It is a bit more tricky in mochitests as I think the path is fixed based on the path of the test. One way around this would be to make the magic path overridable by a pref and set the pref in your test.
  • Test mail servers with TLS. We have test servers but they always use unencrypted connections. I think if it was possible to connect to the server via SSLTunnel that would work (mail protocols really aren't my area). Is it possible?
There may be a way with ssltunnel, but one other option is to run socat to provide a tls front to your smtp server:

  socat openssl-listen:465,cert=/server-cert.pem,key=/server-key.pem,cafile=/ca.pem,reuseaddr,fork tcp4:localhost:25
 
Can you help me with one or more of these things?

--
You received this message because you are subscribed to the Google Groups "dev-pl...@mozilla.org" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dev-platform...@mozilla.org.
To view this discussion on the web visit https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/3c24228e-e430-4add-8835-8ec826665c8en%40mozilla.org.
Reply all
Reply to author
Forward
0 new messages