gitlab-org--gitlab-foss/spec/lib/gitlab/metrics/prometheus_spec.rb
Stan Hu 204af2e101 Support resetting of Prometheus metrics between test runs
Adding the :prometheus tag to an rspec test will clear out
memory-mapped files and reset the registry.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/39968
2018-05-09 14:33:42 -07:00

18 lines
432 B
Ruby

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