2015-09-28 05:01:45 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
feature 'Runners' do
|
|
|
|
given(:user) { create(:user) }
|
2017-06-14 14:18:56 -04:00
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
background do
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2017-06-14 14:18:56 -04:00
|
|
|
end
|
2015-09-28 05:01:45 -04:00
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
context 'when a project has enabled shared_runners' do
|
|
|
|
given(:project) { create(:project) }
|
2015-09-28 05:01:45 -04:00
|
|
|
|
2017-08-23 08:58:45 -04:00
|
|
|
background do
|
|
|
|
project.add_master(user)
|
|
|
|
end
|
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
context 'when a specific runner is activated on the project' do
|
|
|
|
given(:specific_runner) { create(:ci_runner, :specific) }
|
2015-09-28 05:01:45 -04:00
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
background do
|
|
|
|
project.runners << specific_runner
|
|
|
|
end
|
2015-11-16 07:24:36 -05:00
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
scenario 'user sees the specific runner' do
|
|
|
|
visit runners_path(project)
|
2015-09-28 05:01:45 -04:00
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
within '.activated-specific-runners' do
|
|
|
|
expect(page).to have_content(specific_runner.display_name)
|
|
|
|
end
|
2015-09-28 05:01:45 -04:00
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
click_on specific_runner.short_sha
|
2015-11-16 07:24:36 -05:00
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
expect(page).to have_content(specific_runner.platform)
|
2015-09-28 05:01:45 -04:00
|
|
|
end
|
|
|
|
|
2017-08-23 08:58:45 -04:00
|
|
|
scenario 'user removes an activated specific runner if this is last project for that runners' do
|
2017-08-21 10:22:17 -04:00
|
|
|
visit runners_path(project)
|
2015-09-28 05:01:45 -04:00
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
within '.activated-specific-runners' do
|
|
|
|
click_on 'Remove Runner'
|
|
|
|
end
|
2015-09-28 05:01:45 -04:00
|
|
|
|
2017-08-23 08:58:45 -04:00
|
|
|
expect(page).not_to have_content(specific_runner.display_name)
|
2015-09-28 05:01:45 -04:00
|
|
|
end
|
|
|
|
|
2017-08-25 04:46:38 -04:00
|
|
|
scenario 'user edits the runner to be protected' do
|
|
|
|
visit runners_path(project)
|
|
|
|
|
|
|
|
within '.activated-specific-runners' do
|
|
|
|
first('.edit-runner > a').click
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page.find_field('runner[access_level]')).not_to be_checked
|
|
|
|
|
|
|
|
check 'runner_access_level'
|
|
|
|
click_button 'Save changes'
|
|
|
|
|
|
|
|
expect(page).to have_content 'Protected Yes'
|
|
|
|
end
|
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
context 'when a runner has a tag' do
|
|
|
|
background do
|
2017-08-23 08:58:45 -04:00
|
|
|
specific_runner.update(tag_list: ['tag'])
|
2017-08-21 10:22:17 -04:00
|
|
|
end
|
2015-09-28 05:01:45 -04:00
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
scenario 'user edits runner not to run untagged jobs' do
|
|
|
|
visit runners_path(project)
|
2015-09-28 05:01:45 -04:00
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
within '.activated-specific-runners' do
|
|
|
|
first('.edit-runner > a').click
|
|
|
|
end
|
2015-09-28 05:01:45 -04:00
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
expect(page.find_field('runner[run_untagged]')).to be_checked
|
2015-09-28 05:01:45 -04:00
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
uncheck 'runner_run_untagged'
|
|
|
|
click_button 'Save changes'
|
2015-09-28 05:01:45 -04:00
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
expect(page).to have_content 'Can run untagged jobs No'
|
|
|
|
end
|
|
|
|
end
|
2016-04-15 09:51:41 -04:00
|
|
|
|
2017-08-23 08:58:45 -04:00
|
|
|
context 'when a shared runner is activated on the project' do
|
|
|
|
given!(:shared_runner) { create(:ci_runner, :shared) }
|
2016-04-15 09:51:41 -04:00
|
|
|
|
2017-08-23 08:58:45 -04:00
|
|
|
scenario 'user sees CI/CD setting page' do
|
2017-08-21 10:22:17 -04:00
|
|
|
visit runners_path(project)
|
2015-09-28 05:01:45 -04:00
|
|
|
|
2017-08-23 08:58:45 -04:00
|
|
|
expect(page.find('.available-shared-runners')).to have_content(shared_runner.display_name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-05-05 06:20:33 -04:00
|
|
|
|
2017-08-23 08:58:45 -04:00
|
|
|
context 'when a specific runner exists in another project' do
|
|
|
|
given(:another_project) { create(:project) }
|
|
|
|
given(:specific_runner) { create(:ci_runner, :specific) }
|
2016-05-05 06:20:33 -04:00
|
|
|
|
2017-08-23 08:58:45 -04:00
|
|
|
background do
|
|
|
|
another_project.add_master(user)
|
|
|
|
another_project.runners << specific_runner
|
2017-08-21 10:22:17 -04:00
|
|
|
end
|
|
|
|
|
2017-08-23 08:58:45 -04:00
|
|
|
scenario 'user enables and disables a specific runner' do
|
|
|
|
visit runners_path(project)
|
2016-05-05 06:20:33 -04:00
|
|
|
|
2017-08-23 08:58:45 -04:00
|
|
|
within '.available-specific-runners' do
|
|
|
|
click_on 'Enable for this project'
|
|
|
|
end
|
2017-08-21 10:22:17 -04:00
|
|
|
|
2017-08-23 08:58:45 -04:00
|
|
|
expect(page.find('.activated-specific-runners')).to have_content(specific_runner.display_name)
|
|
|
|
|
|
|
|
within '.activated-specific-runners' do
|
|
|
|
click_on 'Disable for this project'
|
2017-08-21 10:22:17 -04:00
|
|
|
end
|
2017-08-23 08:58:45 -04:00
|
|
|
|
|
|
|
expect(page.find('.available-specific-runners')).to have_content(specific_runner.display_name)
|
2017-08-21 10:22:17 -04:00
|
|
|
end
|
2016-05-05 06:20:33 -04:00
|
|
|
end
|
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
context 'when application settings have shared_runners_text' do
|
|
|
|
given(:shared_runners_text) { 'custom **shared** runners description' }
|
|
|
|
given(:shared_runners_html) { 'custom shared runners description' }
|
|
|
|
|
|
|
|
background do
|
|
|
|
stub_application_setting(shared_runners_text: shared_runners_text)
|
2017-06-14 14:18:56 -04:00
|
|
|
end
|
2016-05-05 06:20:33 -04:00
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
scenario 'user sees shared runners description' do
|
2016-05-06 02:41:51 -04:00
|
|
|
visit runners_path(project)
|
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
expect(page.find('.shared-runners-description')).to have_content(shared_runners_html)
|
2016-05-06 02:41:51 -04:00
|
|
|
end
|
2016-05-05 06:20:33 -04:00
|
|
|
end
|
|
|
|
end
|
2017-08-21 10:22:17 -04:00
|
|
|
|
|
|
|
context 'when a project has disabled shared_runners' do
|
|
|
|
given(:project) { create(:project, shared_runners_enabled: false) }
|
|
|
|
|
|
|
|
background do
|
|
|
|
project.add_master(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'user enables shared runners' do
|
|
|
|
visit runners_path(project)
|
|
|
|
|
|
|
|
click_on 'Enable shared Runners'
|
2017-08-23 08:58:45 -04:00
|
|
|
|
2017-08-21 10:22:17 -04:00
|
|
|
expect(page.find('.shared-runners-description')).to have_content('Disable shared Runners')
|
|
|
|
end
|
|
|
|
end
|
2015-09-28 05:01:45 -04:00
|
|
|
end
|