diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
commit | 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch) | |
tree | 4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /spec/services/application_settings | |
parent | 744144d28e3e7fddc117924fef88de5d9674fe4c (diff) |
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'spec/services/application_settings')
-rw-r--r-- | spec/services/application_settings/update_service_spec.rb | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/spec/services/application_settings/update_service_spec.rb b/spec/services/application_settings/update_service_spec.rb index 56c1284927d..a1fd89bcad7 100644 --- a/spec/services/application_settings/update_service_spec.rb +++ b/spec/services/application_settings/update_service_spec.rb @@ -336,6 +336,31 @@ RSpec.describe ApplicationSettings::UpdateService do end end + context 'when general rate limits are passed' do + let(:params) do + { + throttle_authenticated_api_enabled: true, + throttle_authenticated_api_period_in_seconds: 10, + throttle_authenticated_api_requests_per_period: 20, + throttle_authenticated_web_enabled: true, + throttle_authenticated_web_period_in_seconds: 30, + throttle_authenticated_web_requests_per_period: 40, + throttle_unauthenticated_api_enabled: true, + throttle_unauthenticated_api_period_in_seconds: 50, + throttle_unauthenticated_api_requests_per_period: 60, + throttle_unauthenticated_enabled: true, + throttle_unauthenticated_period_in_seconds: 50, + throttle_unauthenticated_requests_per_period: 60 + } + end + + it 'updates general throttle settings' do + subject.execute + + expect(application_settings.reload).to have_attributes(params) + end + end + context 'when package registry rate limits are passed' do let(:params) do { @@ -362,6 +387,52 @@ RSpec.describe ApplicationSettings::UpdateService do end end + context 'when files API rate limits are passed' do + let(:params) do + { + throttle_unauthenticated_files_api_enabled: 1, + throttle_unauthenticated_files_api_period_in_seconds: 500, + throttle_unauthenticated_files_api_requests_per_period: 20, + throttle_authenticated_files_api_enabled: 1, + throttle_authenticated_files_api_period_in_seconds: 600, + throttle_authenticated_files_api_requests_per_period: 10 + } + end + + it 'updates files API throttle settings' do + subject.execute + + application_settings.reload + + expect(application_settings.throttle_unauthenticated_files_api_enabled).to be_truthy + expect(application_settings.throttle_unauthenticated_files_api_period_in_seconds).to eq(500) + expect(application_settings.throttle_unauthenticated_files_api_requests_per_period).to eq(20) + expect(application_settings.throttle_authenticated_files_api_enabled).to be_truthy + expect(application_settings.throttle_authenticated_files_api_period_in_seconds).to eq(600) + expect(application_settings.throttle_authenticated_files_api_requests_per_period).to eq(10) + end + end + + context 'when git lfs rate limits are passed' do + let(:params) do + { + throttle_authenticated_git_lfs_enabled: 1, + throttle_authenticated_git_lfs_period_in_seconds: 600, + throttle_authenticated_git_lfs_requests_per_period: 10 + } + end + + it 'updates git lfs throttle settings' do + subject.execute + + application_settings.reload + + expect(application_settings.throttle_authenticated_git_lfs_enabled).to be_truthy + expect(application_settings.throttle_authenticated_git_lfs_period_in_seconds).to eq(600) + expect(application_settings.throttle_authenticated_git_lfs_requests_per_period).to eq(10) + end + end + context 'when issues_create_limit is passed' do let(:params) do { |