debian-mirror-gitlab/spec/workers/reactive_caching_worker_spec.rb

32 lines
1.1 KiB
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
describe ReactiveCachingWorker do
describe '#perform' do
2018-03-17 18:26:18 +05:30
context 'when user configured kubernetes from CI/CD > Clusters' do
let!(:cluster) { create(:cluster, :project, :provided_by_gcp) }
let(:project) { cluster.project }
2019-09-30 21:07:59 +05:30
let!(:environment) { create(:environment, project: project) }
2018-03-17 18:26:18 +05:30
it 'calls #exclusively_update_reactive_cache!' do
2019-09-30 21:07:59 +05:30
expect_any_instance_of(Environment).to receive(:exclusively_update_reactive_cache!)
2018-03-17 18:26:18 +05:30
2019-09-30 21:07:59 +05:30
described_class.new.perform("Environment", environment.id)
2018-03-17 18:26:18 +05:30
end
2020-03-09 13:42:32 +05:30
context 'when ReactiveCaching::ExceededReactiveCacheLimit is raised' do
it 'avoids failing the job and tracks via Gitlab::ErrorTracking' do
allow_any_instance_of(Environment).to receive(:exclusively_update_reactive_cache!)
.and_raise(ReactiveCaching::ExceededReactiveCacheLimit)
expect(Gitlab::ErrorTracking).to receive(:track_exception)
.with(kind_of(ReactiveCaching::ExceededReactiveCacheLimit))
described_class.new.perform("Environment", environment.id)
end
end
2017-08-17 22:00:37 +05:30
end
end
end