Skip to content

Fix: Geo::ModelMapper flakiness

What does this MR do and why?

Sometimes, when a spec (ee/spec/lib/gitlab/geo/replicator_spec.rb) stubs a replicator runs previously, the Geo::DummyReplicator will exist and be added to the Replicator subclasses used by the ModelMapper. However, the dummy model won't exist anymore - making model_class undefined.

This MR rescues the NameError and creates a dummy class instead removes the dummy replicator from the tested list, so that specs do not fail anymore due to this state leakage.

References

How to set up and validate locally

  1. Checkout master
  2. Run the spec with bundle exec rspec ee/spec/lib/gitlab/geo/replicator_spec.rb ee/spec/lib/gitlab/geo/model_mapper_spec.rb. It fails 😥
  3. Now checkout this MR's branch
  4. Run the spec with the same command. It passes 🎉

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Chloe Fons

Merge request reports

Loading