Skip to content

Gitlab::FakeApplicationSettings doesn't respond to all the methods ApplicationSetting responds to itself

In some cases (when there's no DB connection or pending migrations), we return a Gitlab::FakeApplicationSettings object instead of an ApplicationSetting object to avoid failures due to unknown columns/attributes.

The issue is that in Gitlab::CurrentSettings.method_missing we delegate to current_application_settings which can be an Gitlab::FakeApplicationSettings in the cases described above.

When an attribute reader or predicate method is called, it works because we instantiate Gitlab::FakeApplicationSettings with the current ApplicationSetting.defaults in which we merge the current ApplicationSetting attributes.

But when a method from ApplicationSetting is called, it fails hard since Gitlab::FakeApplicationSettings doesn't respond to it.