diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-06-20 16:42:02 +0300 |
---|---|---|
committer | Clement Ho <ClemMakesApps@gmail.com> | 2017-06-20 18:41:22 +0300 |
commit | 416b61e010090c61e9e3690afa1925b2509f9ad3 (patch) | |
tree | ddcca42ba297fa10361798d81048c8cf12909440 /spec | |
parent | 9c763521859771653472b60795077c7f6512f971 (diff) |
Merge branch '33823_do_not_enable_defaults_when_metrics_folder_is_missing' into 'master'
Do not enable prometheus metrics when metrics folder is missing
See merge request !12263
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/metrics_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/lib/gitlab/metrics_spec.rb b/spec/lib/gitlab/metrics_spec.rb index 5a87b906609..58a84cd3fe1 100644 --- a/spec/lib/gitlab/metrics_spec.rb +++ b/spec/lib/gitlab/metrics_spec.rb @@ -15,6 +15,36 @@ describe Gitlab::Metrics do end end + describe '.prometheus_metrics_enabled_unmemoized' do + subject { described_class.send(:prometheus_metrics_enabled_unmemoized) } + + context 'prometheus metrics enabled in config' do + before do + allow(described_class).to receive(:current_application_settings).and_return(prometheus_metrics_enabled: true) + end + + context 'when metrics folder is present' do + before do + allow(described_class).to receive(:metrics_folder_present?).and_return(true) + end + + it 'metrics are enabled' do + expect(subject).to eq(true) + end + end + + context 'when metrics folder is missing' do + before do + allow(described_class).to receive(:metrics_folder_present?).and_return(false) + end + + it 'metrics are disabled' do + expect(subject).to eq(false) + end + end + end + end + describe '.prometheus_metrics_enabled?' do it 'returns a boolean' do expect(described_class.prometheus_metrics_enabled?).to be_in([true, false]) |