Page
Library
Module
Module type
Parameter
Class
Class type
Source
Lightweight, throwaway instances of databases, message brokers, or any service that runs in a Docker container. Enables reliable integration testing with real services instead of mocks.
opam install testcontainersopen Lwt.Syntax
open Testcontainers_postgres
let () = Lwt_main.run (
Postgres_container.with_postgres (fun _container conn_str ->
Printf.printf "PostgreSQL: %s\n" conn_str;
Lwt.return_unit
)
)# Clone the repository
git clone https://github.com/benodiwal/testcontainers_ocaml.git
cd testcontainers_ocaml
# Install dependencies
opam install . --deps-only
# Run examples
dune exec examples/basic_example.exe
dune exec examples/postgres_example.exe
dune exec examples/redis_example.exe
dune exec examples/mysql_example.exe
dune exec examples/mongo_example.exe
dune exec examples/kafka_example.exe
dune exec examples/elasticsearch_example.exe
dune exec examples/localstack_example.exe
dune exec examples/memcached_example.exe
dune exec examples/mockserver_example.exeModule | Package | Description |
|---|---|---|
PostgreSQL |
| PostgreSQL database |
MySQL |
| MySQL database |
MongoDB |
| MongoDB database |
Redis |
| Redis cache |
RabbitMQ |
| RabbitMQ message broker |
Kafka |
| Apache Kafka (KRaft) |
Elasticsearch |
| Elasticsearch |
LocalStack |
| AWS services emulation |
Memcached |
| Memcached cache |
MockServer |
| HTTP mocking |
Full documentation: https://benodiwal.github.io/testcontainers-ocaml
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Apache-2.0