#docker #testcontainers

dev testcontainers-modules

Community maintained modules for Testcontainers for Rust

14 releases

0.14.0-beta.1 Jun 19, 2023
0.3.5 Feb 29, 2024
0.3.2 Jan 24, 2024
0.2.1 Dec 29, 2023
0.1.0-beta.1 Jun 28, 2023

#40 in Testing

Download history 2665/week @ 2023-11-10 3064/week @ 2023-11-17 2192/week @ 2023-11-24 2973/week @ 2023-12-01 3225/week @ 2023-12-08 3073/week @ 2023-12-15 2583/week @ 2023-12-22 3424/week @ 2023-12-29 4834/week @ 2024-01-05 3725/week @ 2024-01-12 3722/week @ 2024-01-19 4489/week @ 2024-01-26 3656/week @ 2024-02-02 2549/week @ 2024-02-09 3426/week @ 2024-02-16 3571/week @ 2024-02-23

14,089 downloads per month
Used in 21 crates (20 directly)

MIT license

94KB
2K SLoC

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)
  2. Then start using the modules inside your tests.

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::RunnableImage;

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::RunnableImage
};


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

License

Dependencies

~3–4MB
~86K SLoC