diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/controllers/projects/raw_controller_spec.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) | |
download | gitlab-ce-8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca.tar.gz |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/controllers/projects/raw_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/raw_controller_spec.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/spec/controllers/projects/raw_controller_spec.rb b/spec/controllers/projects/raw_controller_spec.rb index 43cf1a16051..dfe7ba34e6d 100644 --- a/spec/controllers/projects/raw_controller_spec.rb +++ b/spec/controllers/projects/raw_controller_spec.rb @@ -5,11 +5,11 @@ require 'spec_helper' RSpec.describe Projects::RawController do include RepoHelpers - let(:project) { create(:project, :public, :repository) } + let_it_be(:project) { create(:project, :public, :repository) } let(:inline) { nil } describe 'GET #show' do - subject do + def get_show get(:show, params: { namespace_id: project.namespace, @@ -19,6 +19,18 @@ RSpec.describe Projects::RawController do }) end + subject { get_show } + + shared_examples 'single Gitaly request' do + it 'makes a single Gitaly request', :request_store, :clean_gitlab_redis_cache do + # Warm up to populate repository cache + get_show + RequestStore.clear! + + expect { get_show }.to change { Gitlab::GitalyClient.get_request_count }.by(1) + end + end + context 'regular filename' do let(:filepath) { 'master/README.md' } @@ -33,6 +45,7 @@ RSpec.describe Projects::RawController do it_behaves_like 'project cache control headers' it_behaves_like 'content disposition headers' + include_examples 'single Gitaly request' end context 'image header' do @@ -48,6 +61,7 @@ RSpec.describe Projects::RawController do it_behaves_like 'project cache control headers' it_behaves_like 'content disposition headers' + include_examples 'single Gitaly request' end context 'with LFS files' do @@ -56,6 +70,7 @@ RSpec.describe Projects::RawController do it_behaves_like 'a controller that can serve LFS files' it_behaves_like 'project cache control headers' + include_examples 'single Gitaly request' end context 'when the endpoint receives requests above the limit', :clean_gitlab_redis_cache do |