summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/metrics/prometheus_spec.rb
blob: b37624982e2140dc50a2fa08991f57b2e82118b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

require 'spec_helper'

describe Gitlab::Metrics::Prometheus, :prometheus do
  let(:all_metrics) { Gitlab::Metrics }
  let(:registry) { all_metrics.registry }

  describe '#reset_registry!' do
    it 'clears existing metrics' do
      registry.counter(:test, 'test metric')

      expect(registry.metrics.count).to eq(1)

      all_metrics.reset_registry!

      expect(all_metrics.registry.metrics.count).to eq(0)
    end
  end
end