From d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 20 Oct 2021 08:43:02 +0000 Subject: Add latest changes from gitlab-org/gitlab@14-4-stable-ee --- spec/lib/gitlab/workhorse_spec.rb | 44 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'spec/lib/gitlab/workhorse_spec.rb') diff --git a/spec/lib/gitlab/workhorse_spec.rb b/spec/lib/gitlab/workhorse_spec.rb index 09f90a3e5b6..8ba56af561d 100644 --- a/spec/lib/gitlab/workhorse_spec.rb +++ b/spec/lib/gitlab/workhorse_spec.rb @@ -244,13 +244,15 @@ RSpec.describe Gitlab::Workhorse do GitalyServer: { features: { 'gitaly-feature-enforce-requests-limits' => 'true' }, address: Gitlab::GitalyClient.address('default'), - token: Gitlab::GitalyClient.token('default') + token: Gitlab::GitalyClient.token('default'), + sidechannel: false } } end before do allow(Gitlab.config.gitaly).to receive(:enabled).and_return(true) + stub_feature_flags(workhorse_use_sidechannel: false) end it 'includes a Repository param' do @@ -332,6 +334,46 @@ RSpec.describe Gitlab::Workhorse do it { expect { subject }.to raise_exception('Unsupported action: download') } end + + context 'when workhorse_use_sidechannel flag is set' do + context 'when a feature flag is set globally' do + before do + stub_feature_flags(workhorse_use_sidechannel: true) + end + + it 'sets the flag to true' do + response = described_class.git_http_ok(repository, Gitlab::GlRepository::PROJECT, user, action) + + expect(response.dig(:GitalyServer, :sidechannel)).to eq(true) + end + end + + context 'when a feature flag is set for a single project' do + before do + stub_feature_flags(workhorse_use_sidechannel: project) + end + + it 'sets the flag to true for that project' do + response = described_class.git_http_ok(repository, Gitlab::GlRepository::PROJECT, user, action) + + expect(response.dig(:GitalyServer, :sidechannel)).to eq(true) + end + + it 'sets the flag to false for other projects' do + other_project = create(:project, :public, :repository) + response = described_class.git_http_ok(other_project.repository, Gitlab::GlRepository::PROJECT, user, action) + + expect(response.dig(:GitalyServer, :sidechannel)).to eq(false) + end + + it 'sets the flag to false when there is no project' do + snippet = create(:personal_snippet, :repository) + response = described_class.git_http_ok(snippet.repository, Gitlab::GlRepository::SNIPPET, user, action) + + expect(response.dig(:GitalyServer, :sidechannel)).to eq(false) + end + end + end end context 'when receive_max_input_size has been updated' do -- cgit v1.2.3