7 ms·
For those using Java, it's also possible to achieve this using Testcontainers[0]. It's nice to have the test DB setup co-located with your test code, and if you
by lemarchr 5y ago
For those using Java, it's also possible to achieve this using Testcontainers[0]. It's nice to have the test DB setup co-located with your test code, and if you're using JUnit it's really easy to manage and align the DB lifecycle, e.g. fresh DB for each test, shared across class, etc.
----------
0: https://www.testcontainers.org/modules/databases https://www.testcontainers.org/modules/databases
- oweiler 5y agoTestcontainers is also available for go https://github.com/testcontainers/testcontainers-go https://github.com/testcontainers/testcontainers-go
- twic 5y agoI've been using this embedded PostgreSQL thing for tests: https://github.com/opentable/otj-pg-embedded https://github.com/opentable/otj-pg-embedded It's very simple to use and works perfectly. The one problem, and it's a significant one, is that it only ships one version of PostgreSQL, and adding another was difficult enough that I didn't.