diff options
Diffstat (limited to 'spec/workers/reactive_caching_worker_spec.rb')
-rw-r--r-- | spec/workers/reactive_caching_worker_spec.rb | 44 |
1 files changed, 1 insertions, 43 deletions
diff --git a/spec/workers/reactive_caching_worker_spec.rb b/spec/workers/reactive_caching_worker_spec.rb index 603ce6160ce..dcb804a7e6e 100644 --- a/spec/workers/reactive_caching_worker_spec.rb +++ b/spec/workers/reactive_caching_worker_spec.rb @@ -3,47 +3,5 @@ require 'spec_helper' describe ReactiveCachingWorker do - describe '#perform' do - context 'when user configured kubernetes from CI/CD > Clusters' do - let!(:cluster) { create(:cluster, :project, :provided_by_gcp) } - let(:project) { cluster.project } - let!(:environment) { create(:environment, project: project) } - - it 'calls #exclusively_update_reactive_cache!' do - expect_any_instance_of(Environment).to receive(:exclusively_update_reactive_cache!) - - described_class.new.perform("Environment", environment.id) - end - - 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 - end - end - - describe 'worker context' do - it 'sets the related class on the job' do - described_class.perform_async('Environment', 1, 'other', 'argument') - - scheduled_job = described_class.jobs.first - - expect(scheduled_job).to include('meta.related_class' => 'Environment') - end - - it 'sets the related class on the job when it was passed as a class' do - described_class.perform_async(Project, 1, 'other', 'argument') - - scheduled_job = described_class.jobs.first - - expect(scheduled_job).to include('meta.related_class' => 'Project') - end - end + it_behaves_like 'reactive cacheable worker' end |