Commit 353746ea authored by Sean McGivern's avatar Sean McGivern

Merge branch...

Merge branch '33401-follow-up-from-add-prometheus-metrics-endpoint-and-basic-infrastructure-to-meter-code' into 'master'

Clean tmpdirs in metrics endpoint specs

Closes #33401

See merge request gitlab-org/gitlab-ce!31529
parents 3c29ea01 4f600340
...@@ -5,12 +5,19 @@ require 'spec_helper' ...@@ -5,12 +5,19 @@ require 'spec_helper'
describe MetricsController do describe MetricsController do
include StubENV include StubENV
let(:metrics_multiproc_dir) { Dir.mktmpdir } let(:metrics_multiproc_dir) { @metrics_multiproc_dir }
let(:whitelisted_ip) { '127.0.0.1' } let(:whitelisted_ip) { '127.0.0.1' }
let(:whitelisted_ip_range) { '10.0.0.0/24' } let(:whitelisted_ip_range) { '10.0.0.0/24' }
let(:ip_in_whitelisted_range) { '10.0.0.1' } let(:ip_in_whitelisted_range) { '10.0.0.1' }
let(:not_whitelisted_ip) { '10.0.1.1' } let(:not_whitelisted_ip) { '10.0.1.1' }
around do |example|
Dir.mktmpdir do |path|
@metrics_multiproc_dir = path
example.run
end
end
before do before do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
allow(Prometheus::Client.configuration).to receive(:multiprocess_files_dir).and_return(metrics_multiproc_dir) allow(Prometheus::Client.configuration).to receive(:multiprocess_files_dir).and_return(metrics_multiproc_dir)
......
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