diff options
author | Toon Claes <toon@gitlab.com> | 2017-04-20 08:44:01 +0200 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2017-04-24 10:07:01 +0200 |
commit | c623c41c2f917e0773a6e3f0b6c78b027ca846f7 (patch) | |
tree | 83c081ab86fd07801fd9c9686245fe8cef1cc8b4 /spec/workers | |
parent | ccb9beeed0e418ef4dea201b3507bd2f4a14b4a2 (diff) | |
download | gitlab-ce-c623c41c2f917e0773a6e3f0b6c78b027ca846f7.tar.gz |
Use a better performing query to find all MRs for pipeline
And add some specs.
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/expire_pipeline_cache_worker_spec.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/workers/expire_pipeline_cache_worker_spec.rb b/spec/workers/expire_pipeline_cache_worker_spec.rb index 0138bfa4359..67f01539ada 100644 --- a/spec/workers/expire_pipeline_cache_worker_spec.rb +++ b/spec/workers/expire_pipeline_cache_worker_spec.rb @@ -7,7 +7,7 @@ describe ExpirePipelineCacheWorker do subject { described_class.new } describe '#perform' do - it 'invalidate Etag caching for project pipelines path' do + it 'invalidates Etag caching for project pipelines path' do pipelines_path = "/#{project.full_path}/pipelines.json" new_mr_pipelines_path = "/#{project.full_path}/merge_requests/new.json" @@ -17,6 +17,18 @@ describe ExpirePipelineCacheWorker do subject.perform(pipeline.id) end + it 'invalidates Etag caching for merge request pipelines if pipeline runs on any commit of that source branch' do + project = create(:project, :repository) + pipeline = create(:ci_empty_pipeline, status: 'created', project: project, ref: 'master', sha: project.repository.commit('master^').id) + merge_request = create(:merge_request, source_project: project, source_branch: pipeline.ref) + merge_request_pipelines_path = "/#{project.full_path}/merge_requests/#{merge_request.iid}/pipelines.json" + + allow_any_instance_of(Gitlab::EtagCaching::Store).to receive(:touch) + expect_any_instance_of(Gitlab::EtagCaching::Store).to receive(:touch).with(merge_request_pipelines_path) + + subject.perform(pipeline.id) + end + it 'updates the cached status for a project' do expect(Gitlab::Cache::Ci::ProjectPipelineStatus).to receive(:update_for_pipeline). with(pipeline) |