- Notifications
You must be signed in to change notification settings - Fork63
Community maintained modules for Testcontainers for Rust
License
testcontainers/testcontainers-rs-modules-community
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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.
- Depend ontestcontainers-modules with necessary features (e.g
postgres
,minio
and etc)- Enable
blocking
feature if you want to use modules within synchronous tests (feature-gate forSyncRunner
)
- Enable
- Then start using the modules inside your tests with either
AsyncRunner
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.
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")}
- MIT license (LICENSE orhttp://opensource.org/licenses/MIT)
About
Community maintained modules for Testcontainers for Rust
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.