Testcontainers

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • dockertest

    Write better integration tests! Dockertest helps you boot up ephermal docker images for your Go tests with minimal work.

  • I've been using Docker containers for integration testing for last few years. I usually roll my own custom solution in Go using the https://github.com/ory/dockertest package though that adds necessary functionality around running migrations, creating kafka topics, or similar. Will definitely need to check out this next time I'm writing a test package

  • testcontainers-node

    Testcontainers is a NodeJS library that supports tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • latte

    Latte is a modern data engineering toolkit. (by turbolytics)

  • Test containers is such a game changer for integration testing, they have language specific docker apis that make it trivial to bring up containers and verify that they are ready doe testing.

    Pretty much every project I create now has testcontainers for integration testing :)

    I setup CI so it lints, builds, unit tests then integration tests (using testcontainers)

    https://github.com/turbolytics/latte/blob/main/.github/workf...

    Their language bindings provide nice helper functions for common database operations (like generating a connection uri from a container user)

    https://github.com/turbolytics/latte/blob/main/internal/sour...

  • kubedock

    Kubedock is a minimal implementation of the docker api that will orchestrate containers on a Kubernetes cluster, rather than running containers locally.

  • We use [kubedock](https://github.com/joyrex2001/kubedock) to run testcontainers in kubernetes clusters. As long as you're only pulling the images, not building or loading them (explicitly not supported by kubedock), it works pretty well.

  • phoenix_container_example

    Production-quality example for Elixir/Phoenix building, testing, and running in containers

  • It's particularly useful for testing a set of microservices.

    See https://github.com/cogini/phoenix_container_example for a full example.

  • Testcontainers

    Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.

  • except the parent is wrong (at least the Java impl). see:

    https://github.com/testcontainers/testcontainers-java/blob/m...

    https://github.com/testcontainers/testcontainers-java/blob/m...

  • dagger

    Application Delivery as Code that Runs Anywhere (by dagger)

  • > GHA has "service containers", but unfortunately the feature is too basic to address real-world use cases: it assumes a container image can just … boot! … and only talk to the code via the network. Real world use cases often require serialized steps between the test & the dependencies, e.g., to create or init database dirs, set up certs, etc.)

    My biased recommendation is to write a custom Dagger function, and run it in your GHA workflow. https://dagger.io

    If you find me on the Dagger discord, I will gladly write a code snippet summarizing what I have in mind, based on what you explained of your CI stack. We use GHA ourselves and use this pattern to great effect.

    Disclaimer: I work there :)

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • embedded-postgres-binaries

    Lightweight bundles of PostgreSQL binaries with reduced size intended for testing purposes.

  • embedded-postgres

    Java embedded PostgreSQL component for testing (by zonkyio)

  • pglite

    Lightweight Postgres packaged as WASM into a TypeScript library for the browser, Node.js, Bun and Deno

  • pytest-docker

    Docker-based integration tests

  • I'm surprised this is getting so much attention. I thought this just standard practice at this point? If you use things like Gitlab CI then you get this via the `services` in your pipeline. The CI job itself runs in a container too.

    I use a very similar thing via pytest-docker: https://github.com/avast/pytest-docker The only difference seems to be you declare your containers via a docker-compose file which I prefer because it's a standard thing you can use elsewhere.

  • services-flake

    NixOS-like services for Nix flakes

  • If your project uses Nix, checkout services-flake for running services via Nix.

    https://github.com/juspay/services-flake

    We actually do this in Nammayatri, an OSS project providing "Uber" for autos in India.

    https://github.com/nammayatri/nammayatri

    There is a services-flake module allowing you to spin the entire nammayatri stack (including postgres, redis, etc.) using a flake app. Similarly, there's one for running load test, which is also run in Jenkins CI.

  • nammayatri

    A Direct-to-Driver open mobility platform powering the next-generation of mobility applications in India.

  • If your project uses Nix, checkout services-flake for running services via Nix.

    https://github.com/juspay/services-flake

    We actually do this in Nammayatri, an OSS project providing "Uber" for autos in India.

    https://github.com/nammayatri/nammayatri

    There is a services-flake module allowing you to spin the entire nammayatri stack (including postgres, redis, etc.) using a flake app. Similarly, there's one for running load test, which is also run in Jenkins CI.

  • gradle-docker-compose-plugin

    Simplifies usage of Docker Compose for integration testing in Gradle environment.

  • Something that improved developer experience by far and also sped up our builds is starting the container dependencies via docker-compose and connect to it for integration testing. This allows reuse of containers, you can connect to it after/during an integration test to debug without having to keep searching for ports constantly.

    With TestContainers - I've perceived that running integration tests / a single test repeatedly locally is extremely slow as the containers are shut down when the java process is killed. This approach allows for this while also allowing to keep it consistent - example, just mount the migrations folder in the start volume of your DB container and you have a like-for-like schema of your prod DB ready for integration tests.

    I've found the https://github.com/avast/gradle-docker-compose-plugin/ very useful for this.

  • otj-pg-embedded

    Java embedded PostgreSQL component for testing

  • Anyone have an opinion of embedded-postgres vs https://github.com/opentable/otj-pg-embedded (of which its a fork) for Clojure use?

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts