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 ...@@ -13,6 +13,15 @@ describe API::GeoNodes, :geo, api: true do
set(:admin) { create(:admin) } set(:admin) { create(:admin) }
set(:user) { create(:user) } 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 describe 'GET /geo_nodes' do
it 'retrieves the Geo nodes if admin is logged in' do it 'retrieves the Geo nodes if admin is logged in' do
get api("/geo_nodes", admin) get api("/geo_nodes", admin)
......
...@@ -68,17 +68,13 @@ describe Geo::MetricsUpdateService, :geo do ...@@ -68,17 +68,13 @@ describe Geo::MetricsUpdateService, :geo do
} }
end end
def reset_prometheus_metrics # FIXME: we don't clear prometheus state between specs, so these specs below
matching_files = File.join(::Prometheus::Client.configuration.multiprocess_files_dir, "*.db") # create *persistent* entries in the prometheus database that may cause other
Dir[matching_files].map { |filename| File.delete(filename) if File.file?(filename) } # specs to transiently fail.
#
# Can't use ::Prometheus::Client.reinitialize_on_pid_change because the PID didn't change # Issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/39968
::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