Commit 6b53dd28 authored by Pawel Chojnacki's avatar Pawel Chojnacki

Cache spec check if prometheus metrics are triggered

parent 8dbb228b
......@@ -33,6 +33,12 @@ describe Gitlab::Metrics::Subscribers::RailsCache do
subscriber.cache_read(event)
end
it 'increments the cache_read_hit total' do
expect(described_class.metric_cache_read_hit_total).to receive(:increment)
subscriber.cache_read(event)
end
context 'when super operation is fetch' do
let(:event) { double(:event, duration: 15.2, payload: { hit: true, super_operation: :fetch }) }
......@@ -57,6 +63,12 @@ describe Gitlab::Metrics::Subscribers::RailsCache do
subscriber.cache_read(event)
end
it 'increments the cache_read_miss total' do
expect(described_class.metric_cache_read_miss_total).to receive(:increment)
subscriber.cache_read(event)
end
context 'when super operation is fetch' do
let(:event) { double(:event, duration: 15.2, payload: { hit: false, super_operation: :fetch }) }
......@@ -72,7 +84,7 @@ describe Gitlab::Metrics::Subscribers::RailsCache do
end
describe '#cache_write' do
it 'increments the cache_write duration' do
it 'observes write duration' do
expect(subscriber).to receive(:observe)
.with(:write, event.duration)
......@@ -81,7 +93,7 @@ describe Gitlab::Metrics::Subscribers::RailsCache do
end
describe '#cache_delete' do
it 'increments the cache_delete duration' do
it 'observes delete duration' do
expect(subscriber).to receive(:observe)
.with(:delete, event.duration)
......@@ -90,7 +102,7 @@ describe Gitlab::Metrics::Subscribers::RailsCache do
end
describe '#cache_exist?' do
it 'increments the cache_exists duration' do
it 'observes the exists duration' do
expect(subscriber).to receive(:observe)
.with(:exists, event.duration)
......
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