How to unit test your database interactions with Docker

This page summarizes the projects mentioned and recommended in the original post on /r/golang

InfluxDB - Purpose built for real-time analytics at any scale.
InfluxDB Platform is powered by columnar analytics, optimized for cost-efficient storage, and built with open data standards.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • gnomock

    Test your code without writing mocks with ephemeral Docker containers 📦 Setup popular services with just a couple lines of code ⏱️ No bash, no yaml, only code 💻

    https://github.com/orlangure/gnomock does this pretty well, but I liked your solution too, it is neat.

  • InfluxDB

    Purpose built for real-time analytics at any scale. InfluxDB Platform is powered by columnar analytics, optimized for cost-efficient storage, and built with open data standards.

    InfluxDB logo
  • go-ddd

    A practical guideline for creating DDD application in Go

    You write easier to maintain integration tests, here’s an example: https://github.com/damianopetrungaro/go-ddd/tree/main/example/order-service/cmd/internal/repo/postgres

  • dockertest

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

    Reminds me of https://github.com/ory/dockertest

  • vcr

    Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.

    I also started from the same starting point but then discovered and started using VCR for creating http stubs - https://github.com/vcr/vcr. It allowed me to write against more realistic and complex test scenarios but didn't support databases.

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

  • When to mock and what to mock in a Web API?

    3 projects | /r/golang | 23 Mar 2023
  • Beginner-friendly resources to learn integration tests for MongoDb based server.

    3 projects | /r/golang | 16 Apr 2022
  • Testcontainers-Go: Effortless Container-Based Testing for Go Developers

    1 project | news.ycombinator.com | 14 Aug 2024
  • Using test helpers in Go

    1 project | dev.to | 16 Feb 2024
  • 🚀 Effortless Integration Tests with Testcontainers in Golang 🧪

    2 projects | dev.to | 4 Sep 2023

Did you konow that Go is
the 4th most popular programming language
based on number of metions?