Commit 4f600340 authored by Peter Leitzen's avatar Peter Leitzen Committed by Sean McGivern

Clean tmpdirs in metrics endpoint specs

parent 3c29ea01
...@@ -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