summaryrefslogtreecommitdiff
path: root/spec/services/ci
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-04-04 17:38:16 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2017-04-06 23:50:36 +0200
commit847b9c82326d4fa1c4ab28f0f500a374e92728cb (patch)
tree044f6fb772c80a2604e79ebf6ffabb3610d58172 /spec/services/ci
parentebae10467d1bfa03370d131533f2905673c03f71 (diff)
downloadgitlab-ce-847b9c82326d4fa1c4ab28f0f500a374e92728cb.tar.gz
Use Etag caching for pipelines json
Enable caching in the Etag::Middleware and when a pipeline changes status, expire the cache for the project pipelines path.
Diffstat (limited to 'spec/services/ci')
-rw-r--r--spec/services/ci/expire_pipeline_cache_service_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/services/ci/expire_pipeline_cache_service_spec.rb b/spec/services/ci/expire_pipeline_cache_service_spec.rb
new file mode 100644
index 00000000000..b8250f99c5a
--- /dev/null
+++ b/spec/services/ci/expire_pipeline_cache_service_spec.rb
@@ -0,0 +1,18 @@
+require 'spec_helper'
+
+describe Ci::ExpirePipelineCacheService, services: true do
+ let(:user) { create(:user) }
+ let(:project) { create(:empty_project) }
+ let(:pipeline) { create(:ci_pipeline, project: project) }
+ subject { described_class.new(project, user) }
+
+ describe '#execute' do
+ it 'invalidate Etag caching for project pipelines path' do
+ path = "/#{project.full_path}/pipelines.json"
+
+ expect_any_instance_of(Gitlab::EtagCaching::Store).to receive(:touch).with(path)
+
+ subject.execute(pipeline)
+ end
+ end
+end