testcontainers-modules
Community maintained modules for testcontainers
Provides modules to use for testing components in accordance with testcontainers-rs. Every module is treated as a feature inside this crate.
Usage
- Depend on testcontainers-modules with necessary features (e.g
postgres,minioand etc)- Enable
blockingfeature if you want to use modules within synchronous tests (feature-gate forSyncRunner)
- Enable
- Then start using the modules inside your tests with either
AsyncRunnerorSyncRunner
Simple example of using postgres module with SyncRunner (blocking and postgres features enabled):
use ;
Note: you don't need to explicitly depend on testcontainers as it's re-exported dependency
of testcontainers-modules with aligned version between these crates.
For example:
use ImageExt;
You can also see examples for more details.
How to override module defaults (version, tag, ENV-variables)
Just use RunnableImage:
use ;
/// Create a Redis module with `6.2-alpine` tag and custom password
License
- MIT license (LICENSE or http://opensource.org/licenses/MIT)