Commit d7085016 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'add-shared-runners-minutes-limit-to-namespace-admin-api' into 'master'

Allow updating shared_runners_minutes_limit on admin Namespace API

See merge request !2225
parents 81313af3 d8ffaa31
---
title: Allow updating shared_runners_minutes_limit on admin Namespace API
merge_request:
author:
......@@ -509,8 +509,11 @@ module API
end
class Namespace < Grape::Entity
expose :plan, if: lambda { |_, options| options[:current_user] && options[:current_user].admin? }
expose :id, :name, :path, :kind, :full_path
# EE-only
expose :shared_runners_minutes_limit, if: lambda { |_, options| options[:current_user]&.admin? }
expose :plan, if: lambda { |_, options| options[:current_user]&.admin? }
end
class MemberAccess < Grape::Entity
......
......@@ -25,6 +25,7 @@ module API
end
params do
optional :plan, type: String, desc: "Namespace or Group plan"
optional :shared_runners_minutes_limit, type: Integer, desc: "Pipeline minutes quota for this namespace"
end
put ':id' do
authenticated_as_admin!
......
......@@ -59,18 +59,20 @@ describe API::Namespaces do
describe 'PUT /namespaces/:id' do
context 'when authenticated as admin' do
it 'updates plan using full_path' do
put api("/namespaces/#{group1.full_path}", admin), plan: 'silver'
it 'updates namespace using full_path' do
put api("/namespaces/#{group1.full_path}", admin), plan: 'silver', shared_runners_minutes_limit: 9001
expect(response).to have_http_status(200)
expect(json_response['plan']).to eq('silver')
expect(json_response['shared_runners_minutes_limit']).to eq(9001)
end
it 'updates plan using id' do
put api("/namespaces/#{group1.id}", admin), plan: 'silver'
it 'updates namespace using id' do
put api("/namespaces/#{group1.id}", admin), plan: 'silver', shared_runners_minutes_limit: 9001
expect(response).to have_http_status(200)
expect(json_response['plan']).to eq('silver')
expect(json_response['shared_runners_minutes_limit']).to eq(9001)
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment