Force eager-loading for some specs that require it
In !72964 (merged), we disabled eager-loading by default when running tests locally.
An issue with is that some tests rely on eager loading. Here are some examples:
-
Tests that search
ObjectSpace
may not be accurate if all objects are not loaded: -
Calls to
Class.descendants
/Class.subclasses
also have the same problem because it usesObjectSpace
:- https://gitlab.com/gitlab-org/gitlab/blob/679ebf13709aa8440e58baa05539ad72b6e12e9b/spec/db/schema_spec.rb#L304-306
- https://gitlab.com/gitlab-org/gitlab/blob/8ba2a598bab0475bd6f2ab9ebcef4a1852b8d512/spec/support/before_all_adapter.rb#L5
- https://gitlab.com/gitlab-org/gitlab/blob/452d554d81b0e310ef0e86eb8ea3a1c7bf6fbf90/spec/support/helpers/migrations_helpers.rb#L70 (this may be fine since the intent is to reset the cache for already loaded models)
- https://gitlab.com/gitlab-org/gitlab/blob/b982790579e7ba60a78971f3b82813d1deac9ad6/ee/spec/models/concerns/elastic/note_spec.rb#L196-200
- https://gitlab.com/gitlab-org/gitlab/blob/6a1017b403b5efe170c45dd0823a5509fad86cc8/ee/spec/models/concerns/elastic/snippet_spec.rb#L67-71