testcontainers/testcontainers-rs
Fork: 120 Star: 592 (更新于 2024-05-03 19:50:44)
license: Apache-2.0
Language: Rust .
A library for integration-testing against docker containers from within Rust.
最后发布版本: 0.16.7 ( 2024-05-02 05:56:20)
Testcontainers-rs
Testcontainers-rs is the official Rust language fork of http://testcontainers.org.
Usage
testcontainers
is the core crate
The crate provides an API for working with containers in a test environment.
- Depend on
testcontainers
- Implement
testcontainers::core::Image
for necessary docker-images - Run it with any available runner
testcontainers::runners::*
(useblocking
feature for synchronous API)
Example:
- Blocking API (under
blocking
feature)
use testcontainers::{core::WaitFor, runners::SyncRunner, GenericImage};
#[test]
fn test_redis() {
let container = GenericImage::new("redis", "7.2.4")
.with_exposed_port(6379)
.with_wait_for(WaitFor::message_on_stdout("Ready to accept connections"))
.start();
}
- Async API
use testcontainers::{core::WaitFor, runners::AsyncRunner, GenericImage};
#[tokio::test]
async fn test_redis() {
let container = GenericImage::new("redis", "7.2.4")
.with_exposed_port(6379)
.with_wait_for(WaitFor::message_on_stdout("Ready to accept connections"))
.start()
.await;
}
Ready-to-use images
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
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
最近版本更新:(数据更新于 2024-05-03 19:48:29)
2024-05-02 05:56:20 0.16.7
2024-05-01 05:28:48 0.16.6
2024-04-30 04:52:44 0.16.5
2024-04-30 03:59:47 0.16.4
2024-04-28 06:36:00 0.16.3
2024-04-28 06:16:33 0.16.2
2024-04-28 05:36:06 0.16.1
2024-04-28 05:09:26 0.16.0
2023-10-05 10:44:30 0.15
2022-06-01 14:41:06 0.14.0
主题(topics):
docker, integration-testing, rust, test-automation, testcontainers, testcontainers-rust, testing
testcontainers/testcontainers-rs同语言 Rust最近更新仓库
2024-05-17 20:37:18 hyperium/h2
2024-05-17 09:14:56 lapce/lapce
2024-05-16 01:31:34 tauri-apps/tauri
2024-05-15 12:28:43 jdx/mise
2024-05-14 22:29:36 astral-sh/uv
2024-05-14 08:03:33 ruffle-rs/ruffle