Unit tests with Vapor and Postgres

Introduction Vapor makes it easy to write unit tests for server-side applications. I particularly find it fantastic that tests can run in memory, not even opening a port. Also, the database can be changed quite easily to use in-memory SQLite: app.databases.use(.sqlite(.memory), as: .sqlite) Doing that would allow a unit test to be quite lightweight. However, I had some issues with that approach. This post is about explaining what that issue was and how I ended up changing my unit tests to use PostgreSQL directly....

January 29, 2022 ยท 5 min