Skip to content

Run Up/Down migrations for database migration tests on both databases

Rutger Wessels requested to merge rw-specs-db-migrations-run-on-both into master

What does this MR do and why?

GitLab production and CI environments are running on two databases: ci and main. Most specs that we have are run against the correct database. However, for tests that test database migrations (spec/migrations), this is not the case.

Specs for database migrations roughly works as follows:

  1. First, we run a database migration that brings back the database in a state that allows us to test a migration
  2. Then, we run the specs for a database migration
  3. Finally, we bring back the database in current state

Step 1 and 3 however, are only run against main database. And step 2 is also run against main database, until explicitly defined to run against ci database.

This MR will address step 1 and step 3. Instead of running the up/down migrations only on main, we will run them on both ci and main database. This is needed for a follow up MR that will enable running the actual specs (step 2) against the correct database.

For geo databases, there is an exception: they only need to work with the geo database. So the old behaviour is kept for migrations for geo database

This MR originates in !114428 (closed) which turned out to be too large and complex.

Original Issue #392004 (closed)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Rutger Wessels

Merge request reports