Commit a818d7bb authored by Stan Hu's avatar Stan Hu

Reset Prometheus metrics in ee/spec/services/geo/metrics_update_service_spec.rb

parent 9808412a
...@@ -68,8 +68,17 @@ describe Geo::MetricsUpdateService, :geo do ...@@ -68,8 +68,17 @@ describe Geo::MetricsUpdateService, :geo do
} }
end end
def reset_prometheus_metrics
matching_files = File.join(::Prometheus::Client.configuration.multiprocess_files_dir, "*.db")
Dir[matching_files].map { |filename| File.delete(filename) if File.file?(filename) }
# Can't use ::Prometheus::Client.reinitialize_on_pid_change because the PID didn't change
::Prometheus::Client::MmapedValue.reset_and_reinitialize
end
before do before do
allow(Gitlab::Metrics).to receive(:prometheus_metrics_enabled?).and_return(true) allow(Gitlab::Metrics).to receive(:prometheus_metrics_enabled?).and_return(true)
reset_prometheus_metrics
end end
describe '#execute' do describe '#execute' 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