Commit cc4bc22a authored by Alexis Reigel's avatar Alexis Reigel

runner can't be assigned to more than 1 group

therefore we don't need the api check.
parent 1a009f1b
...@@ -199,7 +199,6 @@ module API ...@@ -199,7 +199,6 @@ module API
forbidden!("Runner is shared") if runner.is_shared? forbidden!("Runner is shared") if runner.is_shared?
forbidden!("Runner associated with more than one project") if runner.projects.count > 1 forbidden!("Runner associated with more than one project") if runner.projects.count > 1
forbidden!("Runner associated with more that one group") if runner.groups.count > 1
forbidden!("No access granted") unless user_can_access_runner?(runner) forbidden!("No access granted") unless user_can_access_runner?(runner)
end end
......
...@@ -29,8 +29,6 @@ describe API::Runners do ...@@ -29,8 +29,6 @@ describe API::Runners do
let!(:group_runner) { create(:ci_runner, description: 'Group runner', groups: [group]) } let!(:group_runner) { create(:ci_runner, description: 'Group runner', groups: [group]) }
let!(:two_groups_runner) { create(:ci_runner, description: 'Two groups runner', groups: [group, group2]) }
before do before do
# Set project access for users # Set project access for users
create(:project_member, :master, user: user, project: project) create(:project_member, :master, user: user, project: project)
...@@ -49,7 +47,7 @@ describe API::Runners do ...@@ -49,7 +47,7 @@ describe API::Runners do
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(descriptions).to contain_exactly( expect(descriptions).to contain_exactly(
'Project runner', 'Group runner', 'Two projects runner', 'Two groups runner' 'Project runner', 'Group runner', 'Two projects runner'
) )
expect(shared).to be_falsey expect(shared).to be_falsey
end end
...@@ -422,11 +420,6 @@ describe API::Runners do ...@@ -422,11 +420,6 @@ describe API::Runners do
end.to change { Ci::Runner.specific.count }.by(-1) end.to change { Ci::Runner.specific.count }.by(-1)
end end
it 'does not delete group runner with more than one associated group' do
delete api("/runners/#{two_groups_runner.id}", user)
expect(response).to have_http_status(403)
end
it 'deletes group runner for one owned group' do it 'deletes group runner for one owned group' do
expect do expect do
delete api("/runners/#{group_runner.id}", user) delete api("/runners/#{group_runner.id}", user)
......
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