Too Long; Didn't Read
For Terrastruct, which has a little over 50K lines of code as of now, I've only written functional end-to-end tests. This blog post describes a successful setup that took some iterating to get to. When I run each test, I spin up a new database for testing every single time. This ensures that the database we use mirrors the actual one that is used in production. It also starts with a ping, to fail early if something went wrong. The first API call to a server that just booted up opens the connection, and if the second one comes after the first one is done, it can reuse the connection that first one opened up.
Share Your Thoughts