summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2017-05-22 19:24:27 +0200
committerZ.J. van de Weg <git@zjvandeweg.nl>2017-05-22 22:07:11 +0200
commit33961ee418e861a021d7f70bdb1540de9d159b95 (patch)
tree7ef1ab167df1ed029f89695881a8ec84d532350b
parent50a00442285973a390fa448d189ee43cd700d668 (diff)
downloadgitlab-ce-33961ee418e861a021d7f70bdb1540de9d159b95.tar.gz
Add Etag caching for Pipeline#Show action
Due to a typo this was not actually the case. Now that is fixed and performance should improve because of this.
-rw-r--r--lib/gitlab/etag_caching/router.rb2
-rw-r--r--spec/lib/gitlab/etag_caching/router_spec.rb11
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/gitlab/etag_caching/router.rb b/lib/gitlab/etag_caching/router.rb
index ba31041d0c1..bdf885559c5 100644
--- a/lib/gitlab/etag_caching/router.rb
+++ b/lib/gitlab/etag_caching/router.rb
@@ -38,7 +38,7 @@ module Gitlab
'project_pipelines'
),
Gitlab::EtagCaching::Router::Route.new(
- %r(^(?!.*(#{RESERVED_WORDS})).*/pipelines/\d+\.json\z),
+ %r(^(?!.*(#{RESERVED_WORDS_REGEX})).*/pipelines/\d+\.json\z),
'project_pipeline'
)
].freeze
diff --git a/spec/lib/gitlab/etag_caching/router_spec.rb b/spec/lib/gitlab/etag_caching/router_spec.rb
index 5ae4a19263c..46a238b17f4 100644
--- a/spec/lib/gitlab/etag_caching/router_spec.rb
+++ b/spec/lib/gitlab/etag_caching/router_spec.rb
@@ -77,6 +77,17 @@ describe Gitlab::EtagCaching::Router do
expect(result).to be_blank
end
+ it 'matches pipeline#show endpoint' do
+ env = build_env(
+ '/my-group/my-project/pipelines/2.json'
+ )
+
+ result = described_class.match(env)
+
+ expect(result).to be_present
+ expect(result.name).to eq 'project_pipeline'
+ end
+
def build_env(path)
{ 'PATH_INFO' => path }
end