Skip to content

Resolve flaky test

Marius Bobin requested to merge 429877-fix-flaky-test into master

What does this MR do and why?

ActiveRecord descendants tracker in Ruby 3.1 uses Ruby's native way of tracking subclasses. This bypasses our test, leaving temporary tests models in the hierarchy.

We can't use DescendantsTracker.clear because it is disabled when cache classes is enabled.

The workaround is to leave the temp model in the tree, but remove its dependency on the feature flags.

Reproduce:

With Ruby 3.1 execute:

bundle exec rspec spec/models/concerns/ci/partitionable/switch_spec.rb spec/lib/generators/gitlab/partitioning/foreign_keys_generator_spec.rb

On master it will fail, but on this branch it will pass.

See #429877 (closed)

Screenshots or screen recordings

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

Before After

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.

Related to #429877 (closed)

Edited by Marius Bobin

Merge request reports