Get the latest tech news
Setting up PostgreSQL for running integration tests
Setting up PostgreSQL for tests is crucial for achieving performance and reliability. In this article, I'll explain how to set up PostgreSQL for tests and discuss some common pitfalls to avoid.
In our case, due to the use of various PostgreSQL extensions, PL/pgSQL functions, and other PostgreSQL-specific features, we couldn't use SQLite for our tests. With pg_tmp, it takes a few seconds to start and populate the database, and this overhead quickly adds up when running thousands of tests. The end result is that the underlying data is stored in memory, which significantly reduces the overhead of creating a new database.
Or read this on Hacker News