| Crates.io | testcontainers-ext |
| lib.rs | testcontainers-ext |
| version | 0.1.0 |
| created_at | 2025-04-05 11:25:44.20608+00 |
| updated_at | 2025-04-05 11:25:44.20608+00 |
| description | Utilities collection of extension traits for testcontainers-rs. |
| homepage | |
| repository | https://github.com/lonelyhentxi/testcontainers-rs-ext |
| max_upload_size | |
| id | 1622040 |
| size | 67,079 |
Testcontainers-ext is a utilities collection of extension traits for testcontainers-rs.
# or cargo add testcontainers-ext
cargo install testcontainers-ext
use testcontainers::{core::{IntoContainerPort, WaitFor}, runners::SyncRunner, GenericImage, ImageExt};
use testcontainers_ext::ImagePruneExistedLabelExt;
use anyhow::Result;
#[tokio::test]
async fn test () -> Result<()> {
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_prune_existed_label(
"my-project-scope",
"redis",
true,
true
).await?
.start()
.await?;
Ok(())
}
use testcontainers::{core::{IntoContainerPort, WaitFor}, runners::SyncRunner, GenericImage, ImageExt};
use testcontainers_rs_ext::ImageDefaultLogConsumerExt;
use anyhow::Result;
#[tokio::test]
async fn test () -> Result<()> {
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_default_log_consumer()
.start()
.await?;
Ok(())
}
The easiest way to use testcontainers is to depend on ready-to-use images (aka modules).
Modules are available as a community-maintained crate: testcontainers-modules
Licensed under