diff options
author | Toon Claes <toon@gitlab.com> | 2017-04-18 22:26:56 +0300 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2017-04-24 11:07:01 +0300 |
commit | ccb9beeed0e418ef4dea201b3507bd2f4a14b4a2 (patch) | |
tree | ff75331541746d5ab9e27d9151cbccdae214fb43 /spec/workers/expire_pipeline_cache_worker_spec.rb | |
parent | f07edb5af1e18be817e49e0afd86f59a6eef1cd9 (diff) |
Properly expire cache for **all** MRs of a pipeline
Turn ExpirePipelineCacheService into Worker so it can fetch all the
merge requests for which the pipeline runs or did run against.
Diffstat (limited to 'spec/workers/expire_pipeline_cache_worker_spec.rb')
-rw-r--r-- | spec/workers/expire_pipeline_cache_worker_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/workers/expire_pipeline_cache_worker_spec.rb b/spec/workers/expire_pipeline_cache_worker_spec.rb new file mode 100644 index 00000000000..0138bfa4359 --- /dev/null +++ b/spec/workers/expire_pipeline_cache_worker_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +describe ExpirePipelineCacheWorker do + let(:user) { create(:user) } + let(:project) { create(:empty_project) } + let(:pipeline) { create(:ci_pipeline, project: project) } + subject { described_class.new } + + describe '#perform' do + it 'invalidate 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" + + expect_any_instance_of(Gitlab::EtagCaching::Store).to receive(:touch).with(pipelines_path) + expect_any_instance_of(Gitlab::EtagCaching::Store).to receive(:touch).with(new_mr_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) + + subject.perform(pipeline.id) + end + end +end |