- Notifications
You must be signed in to change notification settings - Fork174
A library for integration-testing against docker containers from within Rust.
License
Apache-2.0, MIT licenses found
Licenses found
Apache-2.0
LICENSE-Apache-2.0MIT
LICENSE-MITNotificationsYou must be signed in to change notification settings
testcontainers/testcontainers-rs
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Testcontainers-rs is the official Rust language fork ofhttp://testcontainers.org.
The crate provides an API for working with containers in a test environment.
- Depend on
testcontainers - Implement
testcontainers::core::Imagefor necessary docker-images - Run it with any available runner
testcontainers::runners::*(useblockingfeature for synchronous API)
- Blocking API (under
blockingfeature)
use testcontainers::{core::{IntoContainerPort,WaitFor}, runners::SyncRunner,GenericImage,ImageExt};#[test]fntest_redis(){let container =GenericImage::new("redis","7.2.4").with_exposed_port(6379.tcp()).with_wait_for(WaitFor::message_on_stdout("Ready to accept connections")).with_network("bridge").with_env_var("DEBUG","1").start().expect("Failed to start Redis");}
- Async API
use testcontainers::{core::{IntoContainerPort,WaitFor}, runners::AsyncRunner,GenericImage,ImageExt};#[tokio::test]asyncfntest_redis(){let container =GenericImage::new("redis","7.2.4").with_exposed_port(6379.tcp()).with_wait_for(WaitFor::message_on_stdout("Ready to accept connections")).with_network("bridge").with_env_var("DEBUG","1").start().await.expect("Failed to start Redis");}
The easiest way to usetestcontainers is to depend on ready-to-use images (aka modules).
Modules are available as a community-maintained crate:testcontainers-modules
Licensed under either of
- Apache License, Version 2.0(LICENSE-APACHE orhttp://www.apache.org/licenses/LICENSE-2.0)
- MIT license(LICENSE-MIT orhttp://opensource.org/licenses/MIT)
at your option.
About
A library for integration-testing against docker containers from within Rust.
Topics
Resources
License
Apache-2.0, MIT licenses found
Licenses found
Apache-2.0
LICENSE-Apache-2.0MIT
LICENSE-MITContributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published