Flaky Test on loose_foreign_keys_spec.rb
Summary
When running the test suite in a specific order, the instance variables of Gitlab::Database::LooseForeignKeys are not cleaned up, which leads to the failure of the suite spec/lib/gitlab/database/sharding_key_spec.rb
See here for more context
Steps to reproduce
- Set up the repo locally
- Run
bundle exec rspec spec/lib/gitlab/database/loose_foreign_keys_spec.rb spec/lib/gitlab/database/sharding_key_spec.rb
Example Project
What is the current bug behavior?
Instead of the suite passing, this spec returns
Gitlab::Database::GitlabSchema::UnknownSchemaError:
Could not find gitlab schema for table ci_unknown_table: Any new or deleted tables must be added to the database dictionary See https://docs.gitlab.com/ee/development/database/database_dictionary.html
What is the expected correct behavior?
All specs should be passing
Possible fixes
We believe that we need to reset the instance variable's data here.
Edited by Panos Kanellidis