testcontainers / testcontainers-python

Testcontainers is a Python library that providing a friendly API to run Docker container. It is designed to create runtime environment to use during your automatic tests.
https://testcontainers-python.readthedocs.io/en/latest/
Apache License 2.0
1.44k stars 270 forks source link

New Container: Mailpit #626

Closed oliverlambson closed 3 weeks ago

oliverlambson commented 3 weeks ago

What is the new container you'd like to have?

axllent/mailpit is a full-featured SMTP mock server that's ideal for integration testing.

It allows for simple configs that accept any auth, and can be configured to (1) support STARTTLS and SSL; (2) accept only specific user/password combinations for auth. This covers most ways you would connect to a real SMTP server and is particularly useful for avoiding having to create a specific insecure SMTP handler for testing only—moving the mocking out of application code.

Why not just use a generic container for this?

The SSL support config is non-trivial, as it requires generating a private key and a self-signed certificate, and mounting them to the container. Configuring specific user/pass auth also requires setting multiple env vars in the container in a single string with a specific format.

For an end-user, having an SMTP server that can just be spun up that supports TLS and specific user/pass auth without understanding the internals seems ideal. If nothing else, it means you don't have to repeat the same config over and over again whenever you want to use a mailpit testcontainer.

Other references:

N/A