Skip to content

Test batched background migrations with the correct connection

What does this MR do and why?

Describe in detail what your merge request does and why.

Batched background migration testing was previously not correctly establishing a connection to the correct database with SharedModel.

Thus when testing CI background migrations, it would look on the main database and fail.

Change to using SharedModel.using_connection to use the correct database.

Also change to using the explicit connection when collecting instrumentation about the sampled batches, so that pg_stat_statements is queried for the correct database.

Part of fixing Database testing does not sample migrations for... (gitlab-org/database-team/gitlab-com-database-testing#79 - 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 Simon Tomlinson

Merge request reports

Loading