Changes in in-memory application settings in one spec can break another spec
In https://gitlab.com/gitlab-org/gitlab-ce/blob/75bdbf25a8df0bc317a26f36c497e7a6b26c1eb1/lib/gitlab/current_settings.rb#L63, we memoize the application settings during tests:
def in_memory_application_settings
with_fallback_to_fake_application_settings do
@in_memory_application_settings ||= ::ApplicationSetting.build_from_defaults
end
end
We saw in https://gitlab.com/gitlab-org/gitlab-ee/issues/7511 that if one spec alters these application settings, it's possible another spec will fail if it assumes the value is the default.
We can work around the problem by stubbing the intended value (e.g. https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/7290), but it seems to me that perhaps we should either not memoize these values across specs or have some way (e.g. RequestStore
) to reset them between specs.