diff options
Diffstat (limited to 'spec/requests/api/admin')
-rw-r--r-- | spec/requests/api/admin/plan_limits_spec.rb | 60 |
1 files changed, 57 insertions, 3 deletions
diff --git a/spec/requests/api/admin/plan_limits_spec.rb b/spec/requests/api/admin/plan_limits_spec.rb index 03642ad617e..74ea3b0973f 100644 --- a/spec/requests/api/admin/plan_limits_spec.rb +++ b/spec/requests/api/admin/plan_limits_spec.rb @@ -23,6 +23,14 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do expect(response).to have_gitlab_http_status(:ok) expect(json_response).to be_an Hash + expect(json_response['ci_pipeline_size']).to eq(Plan.default.actual_limits.ci_pipeline_size) + expect(json_response['ci_active_jobs']).to eq(Plan.default.actual_limits.ci_active_jobs) + expect(json_response['ci_active_pipelines']).to eq(Plan.default.actual_limits.ci_active_pipelines) + expect(json_response['ci_project_subscriptions']).to eq(Plan.default.actual_limits.ci_project_subscriptions) + expect(json_response['ci_pipeline_schedules']).to eq(Plan.default.actual_limits.ci_pipeline_schedules) + expect(json_response['ci_needs_size_limit']).to eq(Plan.default.actual_limits.ci_needs_size_limit) + expect(json_response['ci_registered_group_runners']).to eq(Plan.default.actual_limits.ci_registered_group_runners) + expect(json_response['ci_registered_project_runners']).to eq(Plan.default.actual_limits.ci_registered_project_runners) expect(json_response['conan_max_file_size']).to eq(Plan.default.actual_limits.conan_max_file_size) expect(json_response['generic_packages_max_file_size']).to eq(Plan.default.actual_limits.generic_packages_max_file_size) expect(json_response['helm_max_file_size']).to eq(Plan.default.actual_limits.helm_max_file_size) @@ -31,6 +39,7 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do expect(json_response['nuget_max_file_size']).to eq(Plan.default.actual_limits.nuget_max_file_size) expect(json_response['pypi_max_file_size']).to eq(Plan.default.actual_limits.pypi_max_file_size) expect(json_response['terraform_module_max_file_size']).to eq(Plan.default.actual_limits.terraform_module_max_file_size) + expect(json_response['storage_size_limit']).to eq(Plan.default.actual_limits.storage_size_limit) end end @@ -44,6 +53,14 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do expect(response).to have_gitlab_http_status(:ok) expect(json_response).to be_an Hash + expect(json_response['ci_pipeline_size']).to eq(Plan.default.actual_limits.ci_pipeline_size) + expect(json_response['ci_active_jobs']).to eq(Plan.default.actual_limits.ci_active_jobs) + expect(json_response['ci_active_pipelines']).to eq(Plan.default.actual_limits.ci_active_pipelines) + expect(json_response['ci_project_subscriptions']).to eq(Plan.default.actual_limits.ci_project_subscriptions) + expect(json_response['ci_pipeline_schedules']).to eq(Plan.default.actual_limits.ci_pipeline_schedules) + expect(json_response['ci_needs_size_limit']).to eq(Plan.default.actual_limits.ci_needs_size_limit) + expect(json_response['ci_registered_group_runners']).to eq(Plan.default.actual_limits.ci_registered_group_runners) + expect(json_response['ci_registered_project_runners']).to eq(Plan.default.actual_limits.ci_registered_project_runners) expect(json_response['conan_max_file_size']).to eq(Plan.default.actual_limits.conan_max_file_size) expect(json_response['generic_packages_max_file_size']).to eq(Plan.default.actual_limits.generic_packages_max_file_size) expect(json_response['helm_max_file_size']).to eq(Plan.default.actual_limits.helm_max_file_size) @@ -52,6 +69,7 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do expect(json_response['nuget_max_file_size']).to eq(Plan.default.actual_limits.nuget_max_file_size) expect(json_response['pypi_max_file_size']).to eq(Plan.default.actual_limits.pypi_max_file_size) expect(json_response['terraform_module_max_file_size']).to eq(Plan.default.actual_limits.terraform_module_max_file_size) + expect(json_response['storage_size_limit']).to eq(Plan.default.actual_limits.storage_size_limit) end end @@ -84,6 +102,14 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do it 'updates multiple plan limits' do put api('/application/plan_limits', admin), params: { 'plan_name': 'default', + 'ci_pipeline_size': 101, + 'ci_active_jobs': 102, + 'ci_active_pipelines': 103, + 'ci_project_subscriptions': 104, + 'ci_pipeline_schedules': 105, + 'ci_needs_size_limit': 106, + 'ci_registered_group_runners': 107, + 'ci_registered_project_runners': 108, 'conan_max_file_size': 10, 'generic_packages_max_file_size': 20, 'helm_max_file_size': 25, @@ -91,11 +117,20 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do 'npm_max_file_size': 40, 'nuget_max_file_size': 50, 'pypi_max_file_size': 60, - 'terraform_module_max_file_size': 70 + 'terraform_module_max_file_size': 70, + 'storage_size_limit': 80 } expect(response).to have_gitlab_http_status(:ok) expect(json_response).to be_an Hash + expect(json_response['ci_pipeline_size']).to eq(101) + expect(json_response['ci_active_jobs']).to eq(102) + expect(json_response['ci_active_pipelines']).to eq(103) + expect(json_response['ci_project_subscriptions']).to eq(104) + expect(json_response['ci_pipeline_schedules']).to eq(105) + expect(json_response['ci_needs_size_limit']).to eq(106) + expect(json_response['ci_registered_group_runners']).to eq(107) + expect(json_response['ci_registered_project_runners']).to eq(108) expect(json_response['conan_max_file_size']).to eq(10) expect(json_response['generic_packages_max_file_size']).to eq(20) expect(json_response['helm_max_file_size']).to eq(25) @@ -104,6 +139,7 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do expect(json_response['nuget_max_file_size']).to eq(50) expect(json_response['pypi_max_file_size']).to eq(60) expect(json_response['terraform_module_max_file_size']).to eq(70) + expect(json_response['storage_size_limit']).to eq(80) end it 'updates single plan limits' do @@ -131,6 +167,14 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do it 'fails to update plan limits' do put api('/application/plan_limits', admin), params: { 'plan_name': 'default', + 'ci_pipeline_size': 'z', + 'ci_active_jobs': 'y', + 'ci_active_pipelines': 'x', + 'ci_project_subscriptions': 'w', + 'ci_pipeline_schedules': 'v', + 'ci_needs_size_limit': 'u', + 'ci_registered_group_runners': 't', + 'ci_registered_project_runners': 's', 'conan_max_file_size': 'a', 'generic_packages_max_file_size': 'b', 'helm_max_file_size': 'h', @@ -138,11 +182,20 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do 'npm_max_file_size': 'd', 'nuget_max_file_size': 'e', 'pypi_max_file_size': 'f', - 'terraform_module_max_file_size': 'g' + 'terraform_module_max_file_size': 'g', + 'storage_size_limit': 'j' } expect(response).to have_gitlab_http_status(:bad_request) expect(json_response['error']).to include( + 'ci_pipeline_size is invalid', + 'ci_active_jobs is invalid', + 'ci_active_pipelines is invalid', + 'ci_project_subscriptions is invalid', + 'ci_pipeline_schedules is invalid', + 'ci_needs_size_limit is invalid', + 'ci_registered_group_runners is invalid', + 'ci_registered_project_runners is invalid', 'conan_max_file_size is invalid', 'generic_packages_max_file_size is invalid', 'helm_max_file_size is invalid', @@ -150,7 +203,8 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do 'npm_max_file_size is invalid', 'nuget_max_file_size is invalid', 'pypi_max_file_size is invalid', - 'terraform_module_max_file_size is invalid' + 'terraform_module_max_file_size is invalid', + 'storage_size_limit is invalid' ) end end |