Commit aa00e1b0 authored by Nick Thomas's avatar Nick Thomas

"Fix" the Geo+Prometheus spec failure by removing prometheus from one of the specs

parent 5bfaaaa3
......@@ -13,6 +13,15 @@ describe API::GeoNodes, :geo, api: true do
set(:admin) { create(:admin) }
set(:user) { create(:user) }
before do
# FIXME: Skip creating prometheus metrics in these specs as it interacts
# badly with specs in ee/spec/services/geo/metrics_update_spec.rb - we need
# to learn how to reliably clear prometheus state between specs.
#
# https://gitlab.com/gitlab-org/gitlab-ce/issues/39968
allow(Gitlab::Metrics).to receive(:prometheus_metrics_enabled?) { false }
end
describe 'GET /geo_nodes' do
it 'retrieves the Geo nodes if admin is logged in' do
get api("/geo_nodes", admin)
......
......@@ -68,17 +68,13 @@ describe Geo::MetricsUpdateService, :geo do
}
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
# FIXME: we don't clear prometheus state between specs, so these specs below
# create *persistent* entries in the prometheus database that may cause other
# specs to transiently fail.
#
# Issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/39968
before do
allow(Gitlab::Metrics).to receive(:prometheus_metrics_enabled?).and_return(true)
reset_prometheus_metrics
end
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