Crates.io | rusty-docker-compose |
lib.rs | rusty-docker-compose |
version | 0.3.0 |
source | src |
created_at | 2023-08-03 02:19:31.251387 |
updated_at | 2023-08-17 02:31:26.20756 |
description | A Rust library to manage Docker Compose for integration testing, providing control over container lifecycles and logging. |
homepage | |
repository | |
max_upload_size | |
id | 933322 |
size | 6,619 |
rusty-docker-compose
is a Rust library for managing Docker Compose, specifically designed for integration testing. It provides convenient control over container lifecycles and logging.
Add rusty-docker-compose
as a dependency in your Cargo.toml
file:
[dependencies]
rusty-docker-compose = "0.3.0"
Here's a basic example of how to use rusty-docker-compose:
use rusty_docker_compose::DockerComposeCmd;
let docker_compose_cmd = DockerComposeCmd::new(
"tests/docker-compose.yaml",
"target/docker_logs",
);
docker_compose_cmd.up();
// ... run your tests ...
docker_compose_cmd.down();
Alternatively, you can use DockerCompose
to automatically start up and tear down the docker compose when it goes out of scope:
use rusty_docker_compose::DockerCompose;
let _docker_compose = DockerCompose::new(
"tests/docker-compose.yaml",
"target/docker_logs",
);
// ... run your tests ...
For more detailed examples, please refer to the documentation.