diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-05-06 14:18:21 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-05-06 14:18:21 +0200 |
commit | dd93376bdb899bb7ffdad1194ea98f6fb9c37427 (patch) | |
tree | 8f6d97b624d76875a295f9c1724796a6646fcc1c | |
parent | 93770e1c3c331d7d75bd3637fff585f742c0dd00 (diff) | |
download | gitlab-ce-dd93376bdb899bb7ffdad1194ea98f6fb9c37427.tar.gz |
Remove redundant expire pipeline cache service
-rw-r--r-- | app/services/ci/expire_pipeline_cache_service.rb | 64 | ||||
-rw-r--r-- | spec/services/ci/expire_pipeline_cache_service_spec.rb | 28 |
2 files changed, 0 insertions, 92 deletions
diff --git a/app/services/ci/expire_pipeline_cache_service.rb b/app/services/ci/expire_pipeline_cache_service.rb deleted file mode 100644 index e2299d1a79d..00000000000 --- a/app/services/ci/expire_pipeline_cache_service.rb +++ /dev/null @@ -1,64 +0,0 @@ -module Ci - class ExpirePipelineCacheService < BaseService - include Gitlab::Routing - - attr_reader :pipeline - - def execute(pipeline) - @pipeline = pipeline - - Gitlab::EtagCaching::Store.new.tap do |store| - store.touch(project_pipeline_path) - store.touch(project_pipelines_path) - store.touch(commit_pipelines_path) if pipeline.commit - store.touch(new_merge_request_pipelines_path) - - merge_requests_pipelines_paths.each { |path| store.touch(path) } - end - - Gitlab::Cache::Ci::ProjectPipelineStatus.update_for_pipeline(pipeline) - end - - private - - def project_pipelines_path - namespace_project_pipelines_path( - project.namespace, - project, - format: :json) - end - - def commit_pipelines_path - pipelines_namespace_project_commit_path( - project.namespace, - project, - pipeline.commit.id, - format: :json) - end - - def new_merge_request_pipelines_path - new_namespace_project_merge_request_path( - project.namespace, - project, - format: :json) - end - - def merge_requests_pipelines_paths - pipeline.merge_requests.collect do |merge_request| - pipelines_namespace_project_merge_request_path( - project.namespace, - project, - merge_request, - format: :json) - end - end - - def project_pipeline_path - namespace_project_pipeline_path( - project.namespace, - project, - pipeline, - format: :json) - end - end -end diff --git a/spec/services/ci/expire_pipeline_cache_service_spec.rb b/spec/services/ci/expire_pipeline_cache_service_spec.rb deleted file mode 100644 index 94f2352a7d6..00000000000 --- a/spec/services/ci/expire_pipeline_cache_service_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -require 'spec_helper' - -describe Ci::ExpirePipelineCacheService, services: true do - let(:project) { pipeline.project } - let(:pipeline) { create(:ci_pipeline) } - - before do - stub_ci_pipeline_to_return_yaml_file - end - - subject { described_class.new(project, nil).execute(pipeline) } - - describe '#execute' do - it 'creates a new Store' do - expect(Gitlab::EtagCaching::Store).to receive(:new) - .and_call_original - - subject - end - - it 'updates the ProjectPipelineStatus cache' do - expect(Gitlab::Cache::Ci::ProjectPipelineStatus) - .to receive(:update_for_pipeline).with(pipeline) - - subject - end - end -end |