diff --git a/db/fixtures/production/010_settings.rb b/db/fixtures/production/010_settings.rb index a81782d16ff..7626cdb0b9c 100644 --- a/db/fixtures/production/010_settings.rb +++ b/db/fixtures/production/010_settings.rb @@ -20,7 +20,7 @@ end if ENV['GITLAB_PROMETHEUS_METRICS_ENABLED'].present? settings = Gitlab::CurrentSettings.current_application_settings - value = Gitlab::Utils.to_boolean(ENV['GITLAB_PROMETHEUS_METRICS_ENABLED']) + value = Gitlab::Utils.to_boolean(ENV['GITLAB_PROMETHEUS_METRICS_ENABLED']) || false settings.prometheus_metrics_enabled = value save(settings, 'Prometheus metrics enabled flag') end diff --git a/spec/db/production/settings_spec.rb b/spec/db/production/settings_spec.rb index 00c631b866e..a9d015e0666 100644 --- a/spec/db/production/settings_spec.rb +++ b/spec/db/production/settings_spec.rb @@ -42,5 +42,17 @@ describe 'seed production settings', lib: true do expect(settings.prometheus_metrics_enabled).to eq(false) end end + + context 'GITLAB_PROMETHEUS_METRICS_ENABLED is false' do + before do + stub_env('GITLAB_PROMETHEUS_METRICS_ENABLED', '') + end + + it 'prometheus_metrics_enabled is set to false' do + load(settings_file) + + expect(settings.prometheus_metrics_enabled).to eq(false) + end + end end end