Skip to content

Resolve "Specs for Gitlab::Database::TablesLocker are very slow"

What does this MR do and why?

Make specs for Gitlab::Database::TablesLocker faster:

  • Current master: 2 minutes
  • This branch: 28 seconds

The specs for Gitlab::Database::TablesLocker are interacting directly with the database. We lock/unlock all tables during the runtime of the specs. This is very slow.

The Gitlab::Database::TablesLocker is not the responsible class for making the database changes: the database modification is done by Gitlab::Database::LockManager.

So we can mock the LockManager and make these specs run faster.

Related to Issue #390348 (closed)

How to set up and validate locally

Run the specs and check the time it took

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