summaryrefslogtreecommitdiff
path: root/spec/requests/api/settings_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api/settings_spec.rb')
-rw-r--r--spec/requests/api/settings_spec.rb57
1 files changed, 57 insertions, 0 deletions
diff --git a/spec/requests/api/settings_spec.rb b/spec/requests/api/settings_spec.rb
index 4008b57a1cf..f5d261ba4c6 100644
--- a/spec/requests/api/settings_spec.rb
+++ b/spec/requests/api/settings_spec.rb
@@ -47,6 +47,7 @@ RSpec.describe API::Settings, 'Settings', :do_not_mock_admin_mode_setting do
expect(json_response['personal_access_token_prefix']).to be_nil
expect(json_response['admin_mode']).to be(false)
expect(json_response['whats_new_variant']).to eq('all_tiers')
+ expect(json_response['user_deactivation_emails_enabled']).to be(true)
end
end
@@ -133,6 +134,7 @@ RSpec.describe API::Settings, 'Settings', :do_not_mock_admin_mode_setting do
import_sources: 'github,bitbucket',
wiki_page_max_content_bytes: 12345,
personal_access_token_prefix: "GL-",
+ user_deactivation_emails_enabled: false,
admin_mode: true
}
@@ -184,6 +186,7 @@ RSpec.describe API::Settings, 'Settings', :do_not_mock_admin_mode_setting do
expect(json_response['wiki_page_max_content_bytes']).to eq(12345)
expect(json_response['personal_access_token_prefix']).to eq("GL-")
expect(json_response['admin_mode']).to be(true)
+ expect(json_response['user_deactivation_emails_enabled']).to be(false)
end
end
@@ -222,6 +225,45 @@ RSpec.describe API::Settings, 'Settings', :do_not_mock_admin_mode_setting do
expect(json_response['asset_proxy_allowlist']).to eq(['example.com', '*.example.com', 'localhost'])
end
+ it 'supports the deprecated `throttle_unauthenticated_*` attributes' do
+ put api('/application/settings', admin), params: {
+ throttle_unauthenticated_enabled: true,
+ throttle_unauthenticated_period_in_seconds: 123,
+ throttle_unauthenticated_requests_per_period: 456
+ }
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(json_response).to include(
+ 'throttle_unauthenticated_enabled' => true,
+ 'throttle_unauthenticated_period_in_seconds' => 123,
+ 'throttle_unauthenticated_requests_per_period' => 456,
+ 'throttle_unauthenticated_web_enabled' => true,
+ 'throttle_unauthenticated_web_period_in_seconds' => 123,
+ 'throttle_unauthenticated_web_requests_per_period' => 456
+ )
+ end
+
+ it 'prefers the new `throttle_unauthenticated_web_*` attributes' do
+ put api('/application/settings', admin), params: {
+ throttle_unauthenticated_enabled: false,
+ throttle_unauthenticated_period_in_seconds: 0,
+ throttle_unauthenticated_requests_per_period: 0,
+ throttle_unauthenticated_web_enabled: true,
+ throttle_unauthenticated_web_period_in_seconds: 123,
+ throttle_unauthenticated_web_requests_per_period: 456
+ }
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(json_response).to include(
+ 'throttle_unauthenticated_enabled' => true,
+ 'throttle_unauthenticated_period_in_seconds' => 123,
+ 'throttle_unauthenticated_requests_per_period' => 456,
+ 'throttle_unauthenticated_web_enabled' => true,
+ 'throttle_unauthenticated_web_period_in_seconds' => 123,
+ 'throttle_unauthenticated_web_requests_per_period' => 456
+ )
+ end
+
it 'disables ability to switch to legacy storage' do
put api("/application/settings", admin),
params: { hashed_storage_enabled: false }
@@ -552,5 +594,20 @@ RSpec.describe API::Settings, 'Settings', :do_not_mock_admin_mode_setting do
expect(json_response['error']).to eq('whats_new_variant does not have a valid value')
end
end
+
+ context 'sidekiq job limit settings' do
+ it 'updates the settings' do
+ settings = {
+ sidekiq_job_limiter_mode: 'track',
+ sidekiq_job_limiter_compression_threshold_bytes: 1,
+ sidekiq_job_limiter_limit_bytes: 2
+ }.stringify_keys
+
+ put api("/application/settings", admin), params: settings
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(json_response.slice(*settings.keys)).to eq(settings)
+ end
+ end
end
end