Rust MIT

testcontainers-rs-modules-community

Community maintained modules for Testcontainers for Rust

T

testcontainers

Dernière activité 14 sept. 2026
testcontainers/testcontainers-rs-modules-community

175

étoiles

90

forks

35

issues ouvertes

rusttestcontainerstestcontainers-rusttesting

Ce README est souvent en anglais.

testcontainers-modules

Continuous Integration Crates.io Docs.rs

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

  1. Depend on testcontainers-modules with necessary features (e.g postgres, minio and etc)
    • Enable blocking feature if you want to use modules within synchronous tests (feature-gate for SyncRunner)
  2. Then start using the modules inside your tests with either AsyncRunner or SyncRunner

Simple example of using postgres module with SyncRunner (blocking and postgres features enabled):

use testcontainers_modules::{postgres, testcontainers::runners::SyncRunner};

#[test]
fn test_with_postgres() {
    let container = postgres::Postgres::default().start().unwrap();
    let host_ip = container.get_host().unwrap();
    let host_port = container.get_host_port_ipv4(5432).unwrap();
}

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 testcontainers_modules::testcontainers::ImageExt;

You can also see examples for more details.

How to override module defaults (version, tag, ENV-variables)

Just use RunnableImage:

use testcontainers_modules::{
    redis::Redis,
    testcontainers::{ContainerRequest, ImageExt}
};


/// Create a Redis module with `6.2-alpine` tag and custom password
fn create_redis() -> ContainerRequest<Redis> {
    Redis::default()
        .with_tag("6.2-alpine")
        .with_env_var("REDIS_PASSWORD", "my_secret_password")
}

License

Projets similaires

A library for integration-testing against docker containers from within Rust.

Rustdockerintegration-testingrust
Ttestcontainers
1,1 k étoiles199

A container runtime written in Rust

Rustcontainersdockerkubernetes
Yyouki-dev
7,6 k étoiles473

An operating system designed for hosting containers

Rustcontainerslinuxoperating-system
Bbottlerocket-os
9,7 k étoiles585