Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Community maintained modules for Testcontainers for Rust

License

NotificationsYou must be signed in to change notification settings

testcontainers/testcontainers-rs-modules-community

Repository files navigation

Continuous IntegrationCrates.ioDocs.rs

Community maintained modules fortestcontainers

Provides modules to use for testing components in accordance withtestcontainers-rs.Every module is treated as a feature inside this crate.

Usage

  1. Depend ontestcontainers-modules with necessary features (e.gpostgres,minio and etc)
    • Enableblocking feature if you want to use modules within synchronous tests (feature-gate forSyncRunner)
  2. Then start using the modules inside your tests with eitherAsyncRunner orSyncRunner

Simple example of usingpostgres module withSyncRunner (blocking andpostgres features enabled):

use testcontainers_modules::{postgres, testcontainers::runners::SyncRunner};#[test]fntest_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 ontestcontainers as it's re-exported dependencyoftestcontainers-modules with aligned version between these crates.For example:

use testcontainers_modules::testcontainers::ImageExt;

You can also seeexamplesfor more details.

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

Just useRunnableImage:

use testcontainers_modules::{    redis::Redis,    testcontainers::{ContainerRequest,ImageExt}};/// Create a Redis module with `6.2-alpine` tag and custom passwordfncreate_redis() ->ContainerRequest<Redis>{Redis::default().with_tag("6.2-alpine").with_env_var("REDIS_PASSWORD","my_secret_password")}

License

About

Community maintained modules for Testcontainers for Rust

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors48

Languages


[8]ページ先頭

©2009-2025 Movatter.jp