2019-03-30 07:15:48 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-05-22 18:22:50 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 15:08:50 +00:00
|
|
|
RSpec.describe ExpireJobCacheWorker do
|
2020-02-25 03:08:49 +00:00
|
|
|
let_it_be(:pipeline) { create(:ci_empty_pipeline) }
|
2021-04-21 12:09:16 +00:00
|
|
|
|
2017-05-22 18:22:50 +00:00
|
|
|
let(:project) { pipeline.project }
|
2019-12-17 18:07:48 +00:00
|
|
|
|
2017-05-22 18:22:50 +00:00
|
|
|
describe '#perform' do
|
|
|
|
context 'with a job in the pipeline' do
|
2021-03-31 18:09:19 +00:00
|
|
|
let_it_be(:job) { create(:ci_build, pipeline: pipeline) }
|
|
|
|
|
2020-02-19 18:09:10 +00:00
|
|
|
let(:job_args) { job.id }
|
|
|
|
|
2021-09-29 15:11:47 +00:00
|
|
|
it_behaves_like 'an idempotent worker'
|
|
|
|
|
2021-08-24 15:10:36 +00:00
|
|
|
it_behaves_like 'worker with data consistency',
|
|
|
|
described_class,
|
|
|
|
data_consistency: :delayed
|
2017-05-22 18:22:50 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when there is no job in the pipeline' do
|
|
|
|
it 'does not change the etag store' do
|
|
|
|
expect(Gitlab::EtagCaching::Store).not_to receive(:new)
|
|
|
|
|
2020-04-01 15:07:45 +00:00
|
|
|
perform_multiple(non_existing_record_id)
|
2017-05-22 18:22:50 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|