summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRubén Dávila <ruben@gitlab.com>2018-08-01 09:47:14 -0500
committerRubén Dávila <ruben@gitlab.com>2018-09-07 12:27:35 -0500
commit007b81b8e298269bfdc5cac61bc11ae21b3825a5 (patch)
tree385debb0ca13ae715590388d5584cdf2ea0866c1 /spec
parent9083fc04f1add6f7e4628cdb10fef69c6b815ef5 (diff)
downloadgitlab-ce-007b81b8e298269bfdc5cac61bc11ae21b3825a5.tar.gz
Add receive_max_input_size setting to Application settings
If user has configure the setting then it will be passed to gitlab-shell and gitlab-workhorse
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/admin/application_settings_controller_spec.rb7
-rw-r--r--spec/lib/gitlab/workhorse_spec.rb16
-rw-r--r--spec/requests/api/internal_spec.rb20
3 files changed, 43 insertions, 0 deletions
diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb
index 9d10d725ff3..10e1bfc30f9 100644
--- a/spec/controllers/admin/application_settings_controller_spec.rb
+++ b/spec/controllers/admin/application_settings_controller_spec.rb
@@ -78,5 +78,12 @@ describe Admin::ApplicationSettingsController do
expect(response).to redirect_to(admin_application_settings_path)
expect(ApplicationSetting.current.restricted_visibility_levels).to be_empty
end
+
+ it 'updates the receive_max_input_size setting' do
+ put :update, application_setting: { receive_max_input_size: "1024" }
+
+ expect(response).to redirect_to(admin_application_settings_path)
+ expect(ApplicationSetting.current.receive_max_input_size).to eq(1024)
+ end
end
end
diff --git a/spec/lib/gitlab/workhorse_spec.rb b/spec/lib/gitlab/workhorse_spec.rb
index 23869f3d2da..b3f55a2e1bd 100644
--- a/spec/lib/gitlab/workhorse_spec.rb
+++ b/spec/lib/gitlab/workhorse_spec.rb
@@ -336,6 +336,22 @@ describe Gitlab::Workhorse do
it { expect { subject }.to raise_exception('Unsupported action: download') }
end
end
+
+ context 'when receive_max_input_size has been updated' do
+ it 'returns custom git config' do
+ allow(Gitlab::CurrentSettings).to receive(:receive_max_input_size) { 1 }
+
+ expect(subject[:GitConfigOptions]).to be_present
+ end
+ end
+
+ context 'when receive_max_input_size is empty' do
+ it 'returns an empty git config' do
+ allow(Gitlab::CurrentSettings).to receive(:receive_max_input_size) { nil }
+
+ expect(subject[:GitConfigOptions]).to be_empty
+ end
+ end
end
describe '.set_key_and_notify' do
diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb
index 6890f46c724..e0b5b34f9c4 100644
--- a/spec/requests/api/internal_spec.rb
+++ b/spec/requests/api/internal_spec.rb
@@ -369,6 +369,26 @@ describe API::Internal do
expect(user.reload.last_activity_on).to be_nil
end
end
+
+ context 'when receive_max_input_size has been updated' do
+ it 'returns custom git config' do
+ allow(Gitlab::CurrentSettings).to receive(:receive_max_input_size) { 1 }
+
+ push(key, project)
+
+ expect(json_response["git_config_options"]).to be_present
+ end
+ end
+
+ context 'when receive_max_input_size is empty' do
+ it 'returns an empty git config' do
+ allow(Gitlab::CurrentSettings).to receive(:receive_max_input_size) { nil }
+
+ push(key, project)
+
+ expect(json_response["git_config_options"]).to be_empty
+ end
+ end
end
end