diff --git a/spec/lib/gitlab/metrics/subscribers/rails_cache_spec.rb b/spec/lib/gitlab/metrics/subscribers/rails_cache_spec.rb index 7f0b0ecf98e..6ee2e7b13ec 100644 --- a/spec/lib/gitlab/metrics/subscribers/rails_cache_spec.rb +++ b/spec/lib/gitlab/metrics/subscribers/rails_cache_spec.rb @@ -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)