Our great sponsors
-
dockertest
Write better integration tests! Dockertest helps you boot up ephermal docker images for your Go tests with minimal work.
-
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.
Check this repo, in particular this docker-compose-test.yml. This script is then used to spin up a docker with postgres for testing and kills it afterwards.
A couple options I've used as others have stated are to mock the db calls, or spin up a docker container of the db to run tests against. This package from ory called [dockertest](https://github.com/ory/dockertest) has worked really well for me. It supports a lot of commonly used databases and was pretty easy to get started with.