Commit 21561f34 authored by Pawel Chojnacki's avatar Pawel Chojnacki

Correctly handle temporary folder for testing multiproces metrics

parent ef9d9dde
...@@ -269,9 +269,9 @@ group :metrics do ...@@ -269,9 +269,9 @@ group :metrics do
gem 'method_source', '~> 0.8', require: false gem 'method_source', '~> 0.8', require: false
gem 'influxdb', '~> 0.2', require: false gem 'influxdb', '~> 0.2', require: false
# Prometheus # Prometheus
gem 'mmap2', '~> 2.2.6' gem 'mmap2', '~> 2.2.6'
gem 'prometheus-client-mmap' gem 'prometheus-client-mmap', '~>0.7.0.beta3'
end end
group :development do group :development do
......
...@@ -1000,7 +1000,7 @@ DEPENDENCIES ...@@ -1000,7 +1000,7 @@ DEPENDENCIES
pg (~> 0.18.2) pg (~> 0.18.2)
poltergeist (~> 1.9.0) poltergeist (~> 1.9.0)
premailer-rails (~> 1.9.0) premailer-rails (~> 1.9.0)
prometheus-client-mmap prometheus-client-mmap (~> 0.7.0.beta3)
pry-byebug (~> 3.4.1) pry-byebug (~> 3.4.1)
pry-rails (~> 0.3.4) pry-rails (~> 0.3.4)
rack-attack (~> 4.4.1) rack-attack (~> 4.4.1)
......
...@@ -7,7 +7,7 @@ class MetricsController < ActionController::Base ...@@ -7,7 +7,7 @@ class MetricsController < ActionController::Base
CHECKS = [ CHECKS = [
Gitlab::HealthChecks::DbCheck, Gitlab::HealthChecks::DbCheck,
Gitlab::HealthChecks::RedisCheck, Gitlab::HealthChecks::RedisCheck,
Gitlab::HealthChecks::FsShardsCheck, Gitlab::HealthChecks::FsShardsCheck
].freeze ].freeze
def metrics def metrics
......
...@@ -6,8 +6,17 @@ describe MetricsController do ...@@ -6,8 +6,17 @@ describe MetricsController do
let(:token) { current_application_settings.health_check_access_token } let(:token) { current_application_settings.health_check_access_token }
let(:json_response) { JSON.parse(response.body) } let(:json_response) { JSON.parse(response.body) }
around do |examples|
Dir.mktmpdir do |tmp_dir|
@metrics_multiproc_dir = tmp_dir
examples.run
end
end
before do before do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
stub_env('prometheus_multiproc_dir', @metrics_multiproc_dir)
allow(Gitlab::Metrics).to receive(:prometheus_metrics_enabled?).and_return(true)
end end
describe '#metrics' do describe '#metrics' do
......
...@@ -243,7 +243,6 @@ describe Gitlab::Metrics do ...@@ -243,7 +243,6 @@ describe Gitlab::Metrics do
subject { described_class.counter(:counter, 'doc') } subject { described_class.counter(:counter, 'doc') }
it { is_expected.to be_a(Gitlab::Metrics::DummyMetric) } it { is_expected.to be_a(Gitlab::Metrics::DummyMetric) }
end end
describe '#summary' do describe '#summary' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment