Commit bfc694f5 authored by Alexis Reigel's avatar Alexis Reigel

show group runners setup only to group master

parent c585004b
...@@ -20,8 +20,11 @@ ...@@ -20,8 +20,11 @@
- elsif @group_runners.empty? - elsif @group_runners.empty?
This group does not provide any group Runners yet. This group does not provide any group Runners yet.
= render partial: 'ci/runner/how_to_setup_runner', - if can?(current_user, :admin_pipeline, @project.group)
locals: { registration_token: @project.group.runners_token, type: 'group' } = render partial: 'ci/runner/how_to_setup_runner',
locals: { registration_token: @project.group.runners_token, type: 'group' }
- else
Ask your group master to setup a group Runner.
- else - else
%h4.underlined-title Available group Runners : #{@group_runners.count} %h4.underlined-title Available group Runners : #{@group_runners.count}
......
...@@ -187,51 +187,77 @@ feature 'Runners' do ...@@ -187,51 +187,77 @@ feature 'Runners' do
project.add_master(user) project.add_master(user)
end end
context 'project without a group' do given(:group) { create :group }
given(:project) { create :project }
scenario 'group runners are not available' do context 'as project and group master' do
visit runners_path(project) background do
group.add_master(user)
end
context 'project with a group but no group runner' do
given(:project) { create :project, group: group }
scenario 'group runners are not available' do
visit runners_path(project)
expect(page).to have_content 'This project does not belong to a group and can therefore not make use of group Runners.' expect(page).to have_content 'This group does not provide any group Runners yet.'
expect(page).to have_content 'Setup a group Runner manually'
expect(page).not_to have_content 'Ask your group master to setup a group Runner.'
end
end end
end end
context 'project with a group but no group runner' do context 'as project master' do
given(:group) { create :group } context 'project without a group' do
given(:project) { create :project, group: group } given(:project) { create :project }
scenario 'group runners are not available' do scenario 'group runners are not available' do
visit runners_path(project) visit runners_path(project)
expect(page).to have_content 'This group does not provide any group Runners yet.' expect(page).to have_content 'This project does not belong to a group and can therefore not make use of group Runners.'
end
end end
end
context 'project with a group and a group runner' do context 'project with a group but no group runner' do
given(:group) { create :group } given(:group) { create :group }
given(:project) { create :project, group: group } given(:project) { create :project, group: group }
given!(:ci_runner) { create :ci_runner, groups: [group], description: 'group-runner' }
scenario 'group runners are available' do scenario 'group runners are not available' do
visit runners_path(project) visit runners_path(project)
expect(page).to have_content 'This group does not provide any group Runners yet.'
expect(page).to have_content 'Available group Runners : 1' expect(page).not_to have_content 'Setup a group Runner manually'
expect(page).to have_content 'group-runner' expect(page).to have_content 'Ask your group master to setup a group Runner.'
end
end end
scenario 'group runners may be disabled for a project' do context 'project with a group and a group runner' do
visit runners_path(project) given(:group) { create :group }
given(:project) { create :project, group: group }
given!(:ci_runner) { create :ci_runner, groups: [group], description: 'group-runner' }
scenario 'group runners are available' do
visit runners_path(project)
expect(page).to have_content 'Available group Runners : 1'
expect(page).to have_content 'group-runner'
end
click_on 'Disable group Runners' scenario 'group runners may be disabled for a project' do
visit runners_path(project)
click_on 'Disable group Runners'
expect(page).to have_content 'Enable group Runners' expect(page).to have_content 'Enable group Runners'
expect(project.reload.group_runners_enabled).to be false expect(project.reload.group_runners_enabled).to be false
click_on 'Enable group Runners' click_on 'Enable group Runners'
expect(page).to have_content 'Disable group Runners' expect(page).to have_content 'Disable group Runners'
expect(project.reload.group_runners_enabled).to be true expect(project.reload.group_runners_enabled).to be true
end
end end
end end
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