summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-04-18 21:26:56 +0200
committerToon Claes <toon@gitlab.com>2017-04-24 10:07:01 +0200
commitccb9beeed0e418ef4dea201b3507bd2f4a14b4a2 (patch)
treeff75331541746d5ab9e27d9151cbccdae214fb43 /spec
parentf07edb5af1e18be817e49e0afd86f59a6eef1cd9 (diff)
downloadgitlab-ce-ccb9beeed0e418ef4dea201b3507bd2f4a14b4a2.tar.gz
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')
-rw-r--r--spec/models/ci/pipeline_spec.rb4
-rw-r--r--spec/workers/expire_pipeline_cache_worker_spec.rb (renamed from spec/services/ci/expire_pipeline_cache_service_spec.rb)10
2 files changed, 7 insertions, 7 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb
index d7d6a75d38d..42c0791fba1 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -376,8 +376,8 @@ describe Ci::Pipeline, models: true do
end
describe 'pipeline caching' do
- it 'executes ExpirePipelinesCacheService' do
- expect_any_instance_of(Ci::ExpirePipelineCacheService).to receive(:execute).with(pipeline)
+ it 'performs ExpirePipelinesCacheWorker' do
+ expect(ExpirePipelineCacheWorker).to receive(:perform_async).with(pipeline.id)
pipeline.cancel
end
diff --git a/spec/services/ci/expire_pipeline_cache_service_spec.rb b/spec/workers/expire_pipeline_cache_worker_spec.rb
index 166c6dfc93e..0138bfa4359 100644
--- a/spec/services/ci/expire_pipeline_cache_service_spec.rb
+++ b/spec/workers/expire_pipeline_cache_worker_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
-describe Ci::ExpirePipelineCacheService, services: true do
+describe ExpirePipelineCacheWorker do
let(:user) { create(:user) }
let(:project) { create(:empty_project) }
let(:pipeline) { create(:ci_pipeline, project: project) }
- subject { described_class.new(project, user) }
+ subject { described_class.new }
- describe '#execute' do
+ 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"
@@ -14,14 +14,14 @@ describe Ci::ExpirePipelineCacheService, services: true do
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.execute(pipeline)
+ 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.execute(pipeline)
+ subject.perform(pipeline.id)
end
end
end