summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/gpg_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/gpg_spec.rb')
-rw-r--r--spec/lib/gitlab/gpg_spec.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/lib/gitlab/gpg_spec.rb b/spec/lib/gitlab/gpg_spec.rb
index 72c6c8efb5e..66ce2d5cb8a 100644
--- a/spec/lib/gitlab/gpg_spec.rb
+++ b/spec/lib/gitlab/gpg_spec.rb
@@ -143,6 +143,11 @@ RSpec.describe Gitlab::Gpg do
end
it 'keeps track of created and removed keychains in counters' do
+ # Gitlab::Gpg may be memoizing stale counters if a preceding spec resets the Prometheus registry
+ # https://gitlab.com/gitlab-org/gitlab/-/issues/286874
+ described_class.remove_instance_variable(:@tmp_keychains_created)
+ described_class.remove_instance_variable(:@tmp_keychains_removed)
+
created = Gitlab::Metrics.counter(:gpg_tmp_keychains_created_total, 'The number of temporary GPG keychains')
removed = Gitlab::Metrics.counter(:gpg_tmp_keychains_removed_total, 'The number of temporary GPG keychains')