Crate testcontainers_modules
source ·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§
- clickhouse
clickhouseClickhouse (analytics database) testcontainer - cncf_
distribution cncf_distributionCNCF Distribution (container registry) testcontainer - cockroach_
db cockroach_dbCockroachDB (distributed database) testcontainer - consul
consulConsul (identity-based networking) testcontainer - dynamodb_
local dynamodbDynamoDB (NoSQL database) testcontainer - elastic_
search elastic_searchElasticsearch (distributed search engine) testcontainer - elasticmq
elasticmqElasticMQ (message queue) testcontainer - google_
cloud_ sdk_ emulators google_cloud_sdk_emulatorsgoogles cloud sdk emulator testcontainer - hashicorp_
vault hashicorp_vaultHashiCorp Vault (secrets management) testcontainer - k3s
k3sK3s (lightweight kubernetes) testcontainer - kafka
kafkaApache Kafka (data streaming) testcontainer - kwok
kwokKWOK Cluster (Kubernetes WithOut Kubelet) testcontainer - localstack
localstackApache Kafka (data streaming) testcontainer - mariadb
mariadbMariaDB (relational database) testcontainer - meilisearch
meilisearchMeilisearch (search engine) testcontainer - minio
miniominio (object storage) testcontainer - mongo
mongoMongoDB (NoSql database) testcontainer - mosquitto
mosquittomosquitto (mqtt message broker) testcontainer - mssql_
server mssql_serverMicrosoft SQL Server (relational database) testcontainer - mysql
mysqlMySQL (relational database) testcontainer - nats
natsNats (message orineted middleware) testcontainer - neo4j
neo4jNeo4j (graph database) testcontainer - openldap
openldapOpenldap (ldap authentification) testcontainer - oracle
oracleoracle (relational database) testcontainer - orientdb
orientdborientdb (nosql database) testcontainer - parity_
parity parityparity_parity (etherium client) testcontainer - postgres
postgresPostgres (relational database) testcontainer - rabbitmq
rabbitmqrabbitmq (message broker) testcontainer - redis
redisredis (in memory nosql database) testcontainer - solr
solrApache Solr (distributed search engine) testcontainer - surrealdb
surrealdbsurrealdb (mutli model database) testcontainer - trufflesuite_
ganachecli trufflesuite_ganachecliTrufflesuite Ganache CLI (etherium simulator) testcontainer - victoria_
metrics victoria_metricsVictoriaMetrics (monitoring and time series metrics database) testcontainer - zookeeper
zookeeperApache ZooKeeper (locking and configuratin management) testcontainer