Sign inSign up

allansimon/docker-postgres-for-testing

By allansimon

•Updated over 8 years ago

postgresql tuned for performance against all safety rules, to make fast CI test, NOT FOR PRODUCTION

Image
0

120

allansimon/docker-postgres-for-testing repository overview

⁠Docker Postgres For Testing

Docker Hub Docker Stars Docker Pulls Image Size Image Layers

This a docker image based in the official Postgres 9.4 docker image⁠ tweaked for database testing.

It basically configure things like turning off write ahead log (fsync=off) to make it faster. Notice that this can make the database more likely to be in an inconsistent state, if the case of a server crash. This is not a problem for database testing as we are more concerned with fast feedback and not about loosing data.

This is an alternative to H2⁠, in memory SQLite⁠ and HyperSQL⁠. You should consider this as it runs a real PostgreSQL server, that would be very close on what you have in production.

Check the file config.sh for all the configurations.

References:

⁠Tips for writing tests

  • Do all schema setup (DDL) once before running the tests
  • Run the schema setup (DDL), as the DB migration that would run in production
  • Avoid DDL in each test, as that tent to be very slow
  • Before each test, truncate the tables and put some seed data (DML), that should be quick
  • Remember fasts tests are important, slow tests make you avoid refactoring code!

⁠TODO

  • Tweak shared_buffers
  • Tweak work_mem

Tag summary

Content type

Image

Digest

Size

99.4 MB

Last updated

over 8 years ago

docker pull allansimon/docker-postgres-for-testing:patch-1