Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2017-06-16 00:41:47 +0300
committerPawel Chojnacki <pawel@chojnacki.ws>2017-06-19 19:52:23 +0300
commited5c7d11b19c9507206ada5c6e12eef477370fa9 (patch)
treebfcc3cf34e741d558645821e486ecabc73c507e2 /spec/lib/gitlab/metrics_spec.rb
parenta4a5cbf29a983d05b5fc69f8e63fc37e100c8637 (diff)
Do not enable prometheus metrics when data folder is not present.
+ Set defaults correctly only for when not in production or staging + set ENV['prometheus_multiproc_dir'] in config/boot.rb instead of config.ru Test prometheus metrics unmemoized
Diffstat (limited to 'spec/lib/gitlab/metrics_spec.rb')
-rw-r--r--spec/lib/gitlab/metrics_spec.rb30
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])