Expand description
§testcontainers-modules
Community maintained modules for testcontainers
Provides modules to use for testing components in accordance with testcontainers-rs. Every module is treated as a feature inside this crate.
§Usage
- Depend on testcontainers-modules with necessary features (e.g
postgres,minioand etc)- Enable
blockingfeature if you want to use modules within synchronous tests (feature-gate forSyncRunner)
- Enable
- Then start using the modules inside your tests with either
AsyncRunnerorSyncRunner
Simple example of using postgres module with SyncRunner (blocking and postgres features enabled):
ⓘ
use testcontainers_modules::{postgres, testcontainers::runners::SyncRunner};
#[test]
fn test_with_postgres() {
let container = postgres::Postgres::default().start().unwrap();
let host_ip = container.get_host().unwrap();
let host_port = container.get_host_port_ipv4(5432).unwrap();
}Note: you don’t need to explicitly depend on testcontainers as it’s re-exported dependency
of testcontainers-modules with aligned version between these crates.
For example:
use testcontainers_modules::testcontainers::ImageExt;You can also see examples for more details.
§How to override module defaults (version, tag, ENV-variables)
Just use RunnableImage:
ⓘ
use testcontainers_modules::{
redis::Redis,
testcontainers::{ContainerRequest, ImageExt}
};
/// Create a Redis module with `6.2-alpine` tag and custom password
fn create_redis() -> ContainerRequest<Redis> {
Redis::default()
.with_tag("6.2-alpine")
.with_env_var("REDIS_PASSWORD", "my_secret_password")
}§License
- MIT license (LICENSE or http://opensource.org/licenses/MIT)
Please have a look at the documentation of the separate modules for examples on how to use the module.
Re-exports§
pub use testcontainers;
Modules§
- anvil
anvil - Anvil (local blockchain emulator for EVM-compatible development) testcontainer
- arrow_
flightsql arrow_flightsql - arrow_flightsql (Apache Arrow FlightSQL server) testcontainer
- azurite
azurite - Azurite (azure storage emulator) testcontainer
- clickhouse
clickhouse - Clickhouse (analytics database) testcontainer
- cncf_
distribution cncf_distribution - CNCF Distribution (container registry) testcontainer
- cockroach_
db cockroach_db - CockroachDB (distributed database) testcontainer
- consul
consul - Consul (identity-based networking) testcontainer
- cratedb
cratedb - CrateDB (distributed real-time analytics database) testcontainer
- databend
databend - Databend (analytics database) testcontainer
- dex
dex - Dex (OIDC provider) testcontainer
- dynamodb_
local dynamodb - DynamoDB (NoSQL database) testcontainer
- elastic_
search elastic_search - Elasticsearch (distributed search engine) testcontainer
- elasticmq
elasticmq - ElasticMQ (message queue) testcontainer
- gitea
gitea - Gitea (self-hosted Git service) testcontainer
- google_
cloud_ sdk_ emulators google_cloud_sdk_emulators - googles cloud sdk emulator testcontainer
- hashicorp_
vault hashicorp_vault - HashiCorp Vault (secrets management) testcontainer
- k3s
k3s - K3s (lightweight kubernetes) testcontainer
- kafka
kafka - Apache Kafka (data streaming) testcontainer
- kwok
kwok - KWOK Cluster (Kubernetes WithOut Kubelet) testcontainer
- localstack
localstack - LocalStack (local AWS emulation) testcontainer
- mariadb
mariadb - MariaDB (relational database) testcontainer
- meilisearch
meilisearch - Meilisearch (search engine) testcontainer
- minio
minio - minio (object storage) testcontainer
- mongo
mongo - MongoDB (NoSql database) testcontainer
- mosquitto
mosquitto - mosquitto (mqtt message broker) testcontainer
- mssql_
server mssql_server - Microsoft SQL Server (relational database) testcontainer
- mysql
mysql - MySQL (relational database) testcontainer
- nats
nats - Nats (message oriented middleware) testcontainer
- neo4j
neo4j - Neo4j (graph database) testcontainer
- openldap
openldap - Openldap (ldap authentification) testcontainer
- oracle
oracle - oracle (relational database) testcontainer
- orientdb
orientdb - orientdb (nosql database) testcontainer
- parity_
parity parity - parity_parity (etherium client) testcontainer
- postgres
postgres - Postgres (relational database) testcontainer
- pulsar
pulsar - Apache Pulsar (Cloud-Native, Distributed Messaging and Streaming) testcontainer
- rabbitmq
rabbitmq - rabbitmq (message broker) testcontainer
- redis
redis - redis (in memory nosql database) testcontainer
- rqlite
rqlite - RQLite (lightweight, user-friendly, distributed relational database) testcontainer
- scylladb
scylladb - scylladb (distributed NoSQL wide-column data store) testcontainer
- solr
solr - Apache Solr (distributed search engine) testcontainer
- surrealdb
surrealdb - surrealdb (mutli model database) testcontainer
- trufflesuite_
ganachecli trufflesuite_ganachecli - Trufflesuite Ganache CLI (ethereum simulator) testcontainer
- valkey
valkey - Valkey (in memory nosql database) testcontainer
- victoria_
metrics victoria_metrics - VictoriaMetrics (monitoring and time series metrics database) testcontainer
- weaviate
weaviate - Weaviate (Vector database) testcontainer
- zitadel
zitadel - Zitadel (identity and access management) testcontainer
- zookeeper
zookeeper - Apache ZooKeeper (locking and configuration management) testcontainer