Skip to content

Fix flaky test in the BG migration finalization

What does this MR do and why?

Looking at https://app.periscopedata.com/app/gitlab/888968/EP---Flaky-tests, the following test is failing frequently thus surfaced as flaky test:

    context 'when routes backfilling migration is missing' do
      it 'warns migration not found' do
        expect(Gitlab::AppLogger)
          .to receive(:warn).with(/Could not find batched background migration for the given configuration:/)

        migrate!
      end
    end

I suspect that some database records of BG migration class could linger in some cases. Randomized tests might contribute to this issue as well. Therefore, we ensure that the records do not exist in the context block.

2023-03-22_09-50

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

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 Shinya Maeda

Merge request reports