What is the best practice for setting up a local test databases?

Hi all

I'm building an application with docker-compose, with a FastApi and postgres container, I want to create tests for the api and dont know whats the best approach for testing requests that use the database. I've considered:

  1. Having an extra container for a testing database, this seems like a silly overhead for something i only need a fraction of the time
  2. Spin up a test database container when I need it, time consuming if done manually, but I have no idea how to do it from within another container (and i dont believe postgres can be run in memory)
  3. Mock database, it feels like this is leaving a hole if the mock database functions differently from the postgres in any way

What do people think the best practice is for something like this?

submitted by /u/Lokipi
[link] [comments]

from Software Development – methodologies, techniques, and tools. Covering Agile, RUP, Waterfall + more! https://ift.tt/3oXeKTa

Leave a comment

Design a site like this with WordPress.com
Get started
search previous next tag category expand menu location phone mail time cart zoom edit close