diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/models/instance_configuration_spec.rb | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/models/instance_configuration_spec.rb')
-rw-r--r-- | spec/models/instance_configuration_spec.rb | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/spec/models/instance_configuration_spec.rb b/spec/models/instance_configuration_spec.rb index d3566ed04c2..9544f0fe6ec 100644 --- a/spec/models/instance_configuration_spec.rb +++ b/spec/models/instance_configuration_spec.rb @@ -96,6 +96,95 @@ RSpec.describe InstanceConfiguration do expect(gitlab_ci[:artifacts_max_size][:value]).to eq(200.megabytes) end end + + describe '#package_file_size_limits' do + let_it_be(:plan1) { create(:plan, name: 'plan1', title: 'Plan 1') } + let_it_be(:plan2) { create(:plan, name: 'plan2', title: 'Plan 2') } + + before do + create(:plan_limits, + plan: plan1, + conan_max_file_size: 1001, + maven_max_file_size: 1002, + npm_max_file_size: 1003, + nuget_max_file_size: 1004, + pypi_max_file_size: 1005, + terraform_module_max_file_size: 1006, + generic_packages_max_file_size: 1007 + ) + create(:plan_limits, + plan: plan2, + conan_max_file_size: 1101, + maven_max_file_size: 1102, + npm_max_file_size: 1103, + nuget_max_file_size: 1104, + pypi_max_file_size: 1105, + terraform_module_max_file_size: 1106, + generic_packages_max_file_size: 1107 + ) + end + + it 'returns package file size limits' do + file_size_limits = subject.settings[:package_file_size_limits] + + expect(file_size_limits[:Plan1]).to eq({ conan: 1001, maven: 1002, npm: 1003, nuget: 1004, pypi: 1005, terraform_module: 1006, generic: 1007 }) + expect(file_size_limits[:Plan2]).to eq({ conan: 1101, maven: 1102, npm: 1103, nuget: 1104, pypi: 1105, terraform_module: 1106, generic: 1107 }) + end + end + + describe '#rate_limits' do + before do + Gitlab::CurrentSettings.current_application_settings.update!( + throttle_unauthenticated_enabled: false, + throttle_unauthenticated_requests_per_period: 1001, + throttle_unauthenticated_period_in_seconds: 1002, + throttle_authenticated_api_enabled: true, + throttle_authenticated_api_requests_per_period: 1003, + throttle_authenticated_api_period_in_seconds: 1004, + throttle_authenticated_web_enabled: true, + throttle_authenticated_web_requests_per_period: 1005, + throttle_authenticated_web_period_in_seconds: 1006, + throttle_protected_paths_enabled: true, + throttle_protected_paths_requests_per_period: 1007, + throttle_protected_paths_period_in_seconds: 1008, + throttle_unauthenticated_packages_api_enabled: false, + throttle_unauthenticated_packages_api_requests_per_period: 1009, + throttle_unauthenticated_packages_api_period_in_seconds: 1010, + throttle_authenticated_packages_api_enabled: true, + throttle_authenticated_packages_api_requests_per_period: 1011, + throttle_authenticated_packages_api_period_in_seconds: 1012, + issues_create_limit: 1013, + notes_create_limit: 1014, + project_export_limit: 1015, + project_download_export_limit: 1016, + project_import_limit: 1017, + group_export_limit: 1018, + group_download_export_limit: 1019, + group_import_limit: 1020, + raw_blob_request_limit: 1021 + ) + end + + it 'returns rate limits from application settings' do + rate_limits = subject.settings[:rate_limits] + + expect(rate_limits[:unauthenticated]).to eq({ enabled: false, requests_per_period: 1001, period_in_seconds: 1002 }) + expect(rate_limits[:authenticated_api]).to eq({ enabled: true, requests_per_period: 1003, period_in_seconds: 1004 }) + expect(rate_limits[:authenticated_web]).to eq({ enabled: true, requests_per_period: 1005, period_in_seconds: 1006 }) + expect(rate_limits[:protected_paths]).to eq({ enabled: true, requests_per_period: 1007, period_in_seconds: 1008 }) + expect(rate_limits[:unauthenticated_packages_api]).to eq({ enabled: false, requests_per_period: 1009, period_in_seconds: 1010 }) + expect(rate_limits[:authenticated_packages_api]).to eq({ enabled: true, requests_per_period: 1011, period_in_seconds: 1012 }) + expect(rate_limits[:issue_creation]).to eq({ enabled: true, requests_per_period: 1013, period_in_seconds: 60 }) + expect(rate_limits[:note_creation]).to eq({ enabled: true, requests_per_period: 1014, period_in_seconds: 60 }) + expect(rate_limits[:project_export]).to eq({ enabled: true, requests_per_period: 1015, period_in_seconds: 60 }) + expect(rate_limits[:project_export_download]).to eq({ enabled: true, requests_per_period: 1016, period_in_seconds: 60 }) + expect(rate_limits[:project_import]).to eq({ enabled: true, requests_per_period: 1017, period_in_seconds: 60 }) + expect(rate_limits[:group_export]).to eq({ enabled: true, requests_per_period: 1018, period_in_seconds: 60 }) + expect(rate_limits[:group_export_download]).to eq({ enabled: true, requests_per_period: 1019, period_in_seconds: 60 }) + expect(rate_limits[:group_import]).to eq({ enabled: true, requests_per_period: 1020, period_in_seconds: 60 }) + expect(rate_limits[:raw_blob]).to eq({ enabled: true, requests_per_period: 1021, period_in_seconds: 60 }) + end + end end end |