Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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.0
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

testcontainers/testcontainers-rs

Continuous IntegrationCrates.ioDocs.rsSlack

Testcontainers-rs is the official Rust language fork ofhttp://testcontainers.org.

Usage

testcontainers is the core crate

The crate provides an API for working with containers in a test environment.

  1. Depend ontestcontainers
  2. Implementtestcontainers::core::Image for necessary docker-images
  3. Run it with any available runnertestcontainers::runners::* (useblocking feature for synchronous API)

Example:

  • Blocking API (underblocking feature)
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");}

Ready-to-use images

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

License

Licensed under either of

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.0
MIT
LICENSE-MIT

Contributing

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp