[go: up one dir, main page]

Skip to content

Add a real PostgreSQL instance for praefect in tests

Feature to Dogfood

gitaly#2636 (closed)

Goals

The goal of this issue to improve test scenarios and increase code stability.
As of now the praefect instance used for the tests in the gitlab project uses in-memory implementation of the replication event queue enabled in cd624465cef (Disable Praefect SQL queue in tests, 2020-05-21).
The use of the in-memory queue has a couple of downsides:

  • there is no additional operations like a health check of the event job that is under processing
  • there are no serialisation/deserialisation of the replication jobs on store/retrieval operations
  • there is no a real communication between praefect and PostgreSQL instances using a driver which may have it's own issues

We need to spin up a real PostgreSQL instance for the tests (container?) and configure praefect to use it instead of the in-memory implementation.

Iterative steps of implementation

  • Make it possible to optionally run tests with with PG database !80230 (merged)
  • Fix all the failures when running tests with PG
  • Enable by default
  • Profit!

Challenges

  • Running migrations and detecting if migrations need to run. Should it be automatically? Or part of db:migrate? Or fully manual in a separate rake task?
  • DB cleaning: When is the Praefect database truncated? Is Rails doing that, or is Praefect itself responsible?

Why Dogfooding is Important

Edited by Toon Claes