Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/workers/expire_job_cache_worker_spec.rb')
-rw-r--r--spec/workers/expire_job_cache_worker_spec.rb41
1 files changed, 3 insertions, 38 deletions
diff --git a/spec/workers/expire_job_cache_worker_spec.rb b/spec/workers/expire_job_cache_worker_spec.rb
index cbd9dd39336..6b14ccea105 100644
--- a/spec/workers/expire_job_cache_worker_spec.rb
+++ b/spec/workers/expire_job_cache_worker_spec.rb
@@ -13,44 +13,9 @@ RSpec.describe ExpireJobCacheWorker do
let(:job_args) { job.id }
- include_examples 'an idempotent worker' do
- it 'invalidates Etag caching for the job path' do
- job_path = "/#{project.full_path}/builds/#{job.id}.json"
-
- spy_store = Gitlab::EtagCaching::Store.new
-
- allow(Gitlab::EtagCaching::Store).to receive(:new) { spy_store }
-
- expect(spy_store).to receive(:touch)
- .exactly(worker_exec_times).times
- .with(job_path)
- .and_call_original
-
- expect(ExpirePipelineCacheWorker).to receive(:perform_async)
- .with(pipeline.id)
- .exactly(worker_exec_times).times
-
- subject
- end
- end
-
- it 'does not perform extra queries', :aggregate_failures do
- worker = described_class.new
- recorder = ActiveRecord::QueryRecorder.new { worker.perform(job.id) }
-
- occurences = recorder.data.values.flat_map {|v| v[:occurrences]}
- project_queries = occurences.select {|s| s.include?('FROM "projects"')}
- namespace_queries = occurences.select {|s| s.include?('FROM "namespaces"')}
- route_queries = occurences.select {|s| s.include?('FROM "routes"')}
-
- # This worker is run 1 million times an hour, so we need to save as much
- # queries as possible.
- expect(recorder.count).to be <= 1
-
- expect(project_queries.size).to eq(0)
- expect(namespace_queries.size).to eq(0)
- expect(route_queries.size).to eq(0)
- end
+ it_behaves_like 'worker with data consistency',
+ described_class,
+ data_consistency: :delayed
end
context 'when there is no job in the pipeline' do