2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-09-25 12:07:36 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'Runners' do
|
2018-11-08 19:23:39 +05:30
|
|
|
let(:user) { create(:user) }
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
before do
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
context 'when user opens runners page' do
|
2018-11-08 19:23:39 +05:30
|
|
|
let(:project) { create(:project) }
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2018-03-27 19:54:05 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'user can see a button to install runners on kubernetes clusters' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit project_runners_path(project)
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
expect(page).to have_link('Install GitLab Runner on Kubernetes', href: project_clusters_path(project))
|
2018-03-27 19:54:05 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
context 'when a project has enabled shared_runners' do
|
2018-11-08 19:23:39 +05:30
|
|
|
let(:project) { create(:project) }
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
context 'when a project_type runner is activated on the project' do
|
|
|
|
let!(:specific_runner) { create(:ci_runner, :project, projects: [project]) }
|
2015-11-26 14:37:03 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'user sees the specific runner' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit project_runners_path(project)
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
within '.activated-specific-runners' do
|
|
|
|
expect(page).to have_content(specific_runner.display_name)
|
|
|
|
end
|
2015-11-26 14:37:03 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
click_on specific_runner.short_sha
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(page).to have_content(specific_runner.platform)
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'user can pause and resume the specific runner' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit project_runners_path(project)
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
within '.activated-specific-runners' do
|
2021-04-29 21:17:54 +05:30
|
|
|
expect(page).to have_link('Pause')
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
click_on 'Pause'
|
|
|
|
|
|
|
|
within '.activated-specific-runners' do
|
2021-04-29 21:17:54 +05:30
|
|
|
expect(page).to have_link('Resume')
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
click_on 'Resume'
|
|
|
|
|
|
|
|
within '.activated-specific-runners' do
|
2021-04-29 21:17:54 +05:30
|
|
|
expect(page).to have_link('Pause')
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'user removes an activated specific runner if this is last project for that runners' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit project_runners_path(project)
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
within '.activated-specific-runners' do
|
2021-03-08 18:12:59 +05:30
|
|
|
click_on 'Remove runner'
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(page).not_to have_content(specific_runner.display_name)
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'user edits the runner to be protected' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit project_runners_path(project)
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
within '.activated-specific-runners' do
|
2021-04-29 21:17:54 +05:30
|
|
|
first('[data-testid="edit-runner-link"]').click
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(page.find_field('runner[access_level]')).not_to be_checked
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
check 'runner_access_level'
|
|
|
|
click_button 'Save changes'
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(page).to have_content 'Protected Yes'
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
context 'when a runner has a tag' do
|
2018-11-08 19:23:39 +05:30
|
|
|
before do
|
2021-04-29 21:17:54 +05:30
|
|
|
specific_runner.update!(tag_list: ['tag'])
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'user edits runner not to run untagged jobs' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit project_runners_path(project)
|
2015-09-25 12:07:36 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
within '.activated-specific-runners' do
|
2021-04-29 21:17:54 +05:30
|
|
|
first('[data-testid="edit-runner-link"]').click
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(page.find_field('runner[run_untagged]')).to be_checked
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
uncheck 'runner_run_untagged'
|
|
|
|
click_button 'Save changes'
|
|
|
|
|
|
|
|
expect(page).to have_content 'Can run untagged jobs No'
|
|
|
|
end
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
context 'when a shared runner is activated on the project' do
|
2018-11-08 19:23:39 +05:30
|
|
|
let!(:shared_runner) { create(:ci_runner, :instance) }
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'user sees CI/CD setting page' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit project_runners_path(project)
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
expect(page.find('.available-shared-runners')).to have_content(shared_runner.display_name)
|
|
|
|
end
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
context 'when multiple runners are configured' do
|
|
|
|
let!(:specific_runner) { create(:ci_runner, :project, projects: [project]) }
|
|
|
|
let!(:specific_runner_2) { create(:ci_runner, :project, projects: [project]) }
|
|
|
|
|
|
|
|
it 'adds pagination to the runner list' do
|
|
|
|
stub_const('Projects::Settings::CiCdController::NUMBER_OF_RUNNERS_PER_PAGE', 1)
|
|
|
|
|
|
|
|
visit project_runners_path(project)
|
|
|
|
|
|
|
|
expect(find('.pagination')).not_to be_nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
context 'when a specific runner exists in another project' do
|
2018-11-08 19:23:39 +05:30
|
|
|
let(:another_project) { create(:project) }
|
|
|
|
let!(:specific_runner) { create(:ci_runner, :project, projects: [another_project]) }
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
another_project.add_maintainer(user)
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'user enables and disables a specific runner' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit project_runners_path(project)
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
within '.available-specific-runners' do
|
|
|
|
click_on 'Enable for this project'
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(page.find('.activated-specific-runners')).to have_content(specific_runner.display_name)
|
|
|
|
|
|
|
|
within '.activated-specific-runners' do
|
|
|
|
click_on 'Disable for this project'
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(page.find('.available-specific-runners')).to have_content(specific_runner.display_name)
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'shared runner text' do
|
|
|
|
context 'when application settings have no shared_runners_text' do
|
|
|
|
it 'user sees default shared runners description' do
|
|
|
|
visit project_runners_path(project)
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
page.within("[data-testid='shared-runners-description']") do
|
|
|
|
expect(page).to have_content('The same shared runner executes code from multiple projects')
|
|
|
|
end
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'when application settings have shared_runners_text' do
|
|
|
|
let(:shared_runners_text) { 'custom **shared** runners description' }
|
|
|
|
let(:shared_runners_html) { 'custom shared runners description' }
|
|
|
|
|
|
|
|
before do
|
|
|
|
stub_application_setting(shared_runners_text: shared_runners_text)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'user sees shared runners description' do
|
|
|
|
visit project_runners_path(project)
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
page.within("[data-testid='shared-runners-description']") do
|
|
|
|
expect(page).not_to have_content('The same shared runner executes code from multiple projects')
|
|
|
|
expect(page).to have_content(shared_runners_html)
|
|
|
|
end
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'when application settings have an unsafe link in shared_runners_text' do
|
|
|
|
let(:shared_runners_text) { '<a href="javascript:alert(\'xss\')">link</a>' }
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
before do
|
|
|
|
stub_application_setting(shared_runners_text: shared_runners_text)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'user sees no link' do
|
|
|
|
visit project_runners_path(project)
|
|
|
|
|
|
|
|
page.within("[data-testid='shared-runners-description']") do
|
|
|
|
expect(page).to have_content('link')
|
|
|
|
expect(page).not_to have_link('link')
|
|
|
|
end
|
|
|
|
end
|
2021-02-22 17:27:13 +05:30
|
|
|
end
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'when application settings have an unsafe image in shared_runners_text' do
|
|
|
|
let(:shared_runners_text) { '<img src="404.png" onerror="alert(\'xss\')"/>' }
|
|
|
|
|
|
|
|
before do
|
|
|
|
stub_application_setting(shared_runners_text: shared_runners_text)
|
|
|
|
end
|
2021-02-22 17:27:13 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'user sees image safely' do
|
|
|
|
visit project_runners_path(project)
|
2021-02-22 17:27:13 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
page.within("[data-testid='shared-runners-description']") do
|
|
|
|
expect(page).to have_css('img')
|
|
|
|
expect(page).not_to have_css('img[onerror]')
|
|
|
|
end
|
|
|
|
end
|
2021-02-22 17:27:13 +05:30
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
2021-06-08 01:23:25 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
context 'enable shared runners in project settings', :js do
|
|
|
|
before do
|
|
|
|
project.add_maintainer(user)
|
|
|
|
|
|
|
|
visit project_runners_path(project)
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'when a project has enabled shared_runners' do
|
|
|
|
let(:project) { create(:project, shared_runners_enabled: true) }
|
|
|
|
|
|
|
|
it 'shared runners toggle is on' do
|
|
|
|
expect(page).to have_selector('[data-testid="toggle-shared-runners"]')
|
|
|
|
expect(page).to have_selector('[data-testid="toggle-shared-runners"] .is-checked')
|
2021-02-22 17:27:13 +05:30
|
|
|
end
|
2021-06-08 01:23:25 +05:30
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'when a project has disabled shared_runners' do
|
|
|
|
let(:project) { create(:project, shared_runners_enabled: false) }
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'shared runners toggle is off' do
|
|
|
|
expect(page).not_to have_selector('[data-testid="toggle-shared-runners"] .is-checked')
|
2021-02-22 17:27:13 +05:30
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
2018-10-15 14:42:47 +05:30
|
|
|
|
|
|
|
context 'group runners in project settings' do
|
2018-11-08 19:23:39 +05:30
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
let(:group) { create :group }
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
context 'as project and group maintainer' do
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
group.add_maintainer(user)
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
context 'project with a group but no group runner' do
|
2018-11-08 19:23:39 +05:30
|
|
|
let(:project) { create :project, group: group }
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'group runners are not available' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit project_runners_path(project)
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
expect(page).to have_content 'This group does not have any group runners yet.'
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
expect(page).to have_content 'Group maintainers can register group runners in the group\'s CI/CD settings.'
|
|
|
|
expect(page).not_to have_content 'Ask your group maintainer to set up a group runner'
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
context 'as project maintainer' do
|
2018-10-15 14:42:47 +05:30
|
|
|
context 'project without a group' do
|
2018-11-08 19:23:39 +05:30
|
|
|
let(:project) { create :project }
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'group runners are not available' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit project_runners_path(project)
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
expect(page).to have_content 'This project does not belong to a group and cannot make use of group runners.'
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'project with a group but no group runner' do
|
2018-11-08 19:23:39 +05:30
|
|
|
let(:group) { create(:group) }
|
|
|
|
let(:project) { create(:project, group: group) }
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'group runners are not available' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit project_runners_path(project)
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
expect(page).to have_content 'This group does not have any group runners yet.'
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
expect(page).not_to have_content 'Group maintainers can register group runners in the group\'s CI/CD settings.'
|
|
|
|
expect(page).to have_content 'Ask your group maintainer to set up a group runner.'
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'project with a group and a group runner' do
|
2018-11-08 19:23:39 +05:30
|
|
|
let(:group) { create(:group) }
|
|
|
|
let(:project) { create(:project, group: group) }
|
|
|
|
let!(:ci_runner) { create(:ci_runner, :group, groups: [group], description: 'group-runner') }
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'group runners are available' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit project_runners_path(project)
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
expect(page).to have_content 'Available group runners: 1'
|
2018-10-15 14:42:47 +05:30
|
|
|
expect(page).to have_content 'group-runner'
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'group runners may be disabled for a project' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit project_runners_path(project)
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
click_on 'Disable group runners'
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
expect(page).to have_content 'Enable group runners'
|
2018-10-15 14:42:47 +05:30
|
|
|
expect(project.reload.group_runners_enabled).to be false
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
click_on 'Enable group runners'
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
expect(page).to have_content 'Disable group runners'
|
2018-10-15 14:42:47 +05:30
|
|
|
expect(project.reload.group_runners_enabled).to be true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'group runners in group settings' do
|
2018-11-08 19:23:39 +05:30
|
|
|
let(:group) { create(:group) }
|
2019-01-03 12:48:30 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
before do
|
2019-01-03 12:48:30 +05:30
|
|
|
group.add_owner(user)
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
context 'group with no runners' do
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'there are no runners displayed' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
expect(page).to have_content 'No runners found'
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
2019-12-21 20:55:43 +05:30
|
|
|
|
|
|
|
it 'user can see a link to install runners on kubernetes clusters' do
|
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
expect(page).to have_link('Install GitLab Runner on Kubernetes', href: group_clusters_path(group))
|
2019-12-21 20:55:43 +05:30
|
|
|
end
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
context 'group with a runner' do
|
2018-11-08 19:23:39 +05:30
|
|
|
let!(:runner) { create(:ci_runner, :group, groups: [group], description: 'group-runner') }
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'the runner is visible' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
expect(page).not_to have_content 'No runners found'
|
2021-03-08 18:12:59 +05:30
|
|
|
expect(page).to have_content 'Available runners: 1'
|
2018-10-15 14:42:47 +05:30
|
|
|
expect(page).to have_content 'group-runner'
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'user can pause and resume the group runner' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
expect(page).to have_link href: pause_group_runner_path(group, runner)
|
|
|
|
expect(page).not_to have_link href: resume_group_runner_path(group, runner)
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
click_link href: pause_group_runner_path(group, runner)
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
expect(page).not_to have_link href: pause_group_runner_path(group, runner)
|
|
|
|
expect(page).to have_link href: resume_group_runner_path(group, runner)
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
click_link href: resume_group_runner_path(group, runner)
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
expect(page).to have_link href: pause_group_runner_path(group, runner)
|
|
|
|
expect(page).not_to have_link href: resume_group_runner_path(group, runner)
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'user can view runner details' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
|
|
|
expect(page).to have_content(runner.display_name)
|
|
|
|
|
|
|
|
click_on runner.short_sha
|
|
|
|
|
|
|
|
expect(page).to have_content(runner.platform)
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'user can remove a group runner' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
all(:link, href: group_runner_path(group, runner))[1].click
|
2018-10-15 14:42:47 +05:30
|
|
|
|
|
|
|
expect(page).not_to have_content(runner.display_name)
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'user edits the runner to be protected' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
click_link href: edit_group_runner_path(group, runner)
|
2018-10-15 14:42:47 +05:30
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
context 'when a runner has a tag' do
|
2018-11-08 19:23:39 +05:30
|
|
|
before do
|
2021-04-29 21:17:54 +05:30
|
|
|
runner.update!(tag_list: ['tag'])
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'user edits runner not to run untagged jobs' do
|
2018-10-15 14:42:47 +05:30
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
click_link href: edit_group_runner_path(group, runner)
|
|
|
|
|
|
|
|
expect(page.find_field('runner[run_untagged]')).to be_checked
|
|
|
|
|
|
|
|
uncheck 'runner_run_untagged'
|
|
|
|
click_button 'Save changes'
|
|
|
|
|
|
|
|
expect(page).to have_content 'Can run untagged jobs No'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'group with a project runner' do
|
|
|
|
let(:project) { create(:project, group: group) }
|
|
|
|
let!(:runner) { create(:ci_runner, :project, projects: [project], description: 'project-runner') }
|
|
|
|
|
|
|
|
it 'the runner is visible' do
|
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
|
|
|
expect(page).not_to have_content 'No runners found'
|
2021-03-08 18:12:59 +05:30
|
|
|
expect(page).to have_content 'Available runners: 1'
|
2020-07-28 23:09:34 +05:30
|
|
|
expect(page).to have_content 'project-runner'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'user can pause and resume the project runner' do
|
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
|
|
|
expect(page).to have_link href: pause_group_runner_path(group, runner)
|
|
|
|
expect(page).not_to have_link href: resume_group_runner_path(group, runner)
|
|
|
|
|
|
|
|
click_link href: pause_group_runner_path(group, runner)
|
|
|
|
|
|
|
|
expect(page).not_to have_link href: pause_group_runner_path(group, runner)
|
|
|
|
expect(page).to have_link href: resume_group_runner_path(group, runner)
|
|
|
|
|
|
|
|
click_link href: resume_group_runner_path(group, runner)
|
|
|
|
|
|
|
|
expect(page).to have_link href: pause_group_runner_path(group, runner)
|
|
|
|
expect(page).not_to have_link href: resume_group_runner_path(group, runner)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'user can view runner details' do
|
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
|
|
|
expect(page).to have_content(runner.display_name)
|
|
|
|
|
|
|
|
click_on runner.short_sha
|
|
|
|
|
|
|
|
expect(page).to have_content(runner.platform)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'user can remove a project runner' do
|
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
|
|
|
all(:link, href: group_runner_path(group, runner))[1].click
|
|
|
|
|
|
|
|
expect(page).not_to have_content(runner.display_name)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'user edits the runner to be protected' do
|
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
|
|
|
click_link href: edit_group_runner_path(group, runner)
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
context 'when a runner has a tag' do
|
|
|
|
before do
|
2021-04-29 21:17:54 +05:30
|
|
|
runner.update!(tag_list: ['tag'])
|
2020-07-28 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'user edits runner not to run untagged jobs' do
|
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
|
|
|
click_link href: edit_group_runner_path(group, runner)
|
2018-10-15 14:42:47 +05:30
|
|
|
|
|
|
|
expect(page.find_field('runner[run_untagged]')).to be_checked
|
|
|
|
|
|
|
|
uncheck 'runner_run_untagged'
|
|
|
|
click_button 'Save changes'
|
|
|
|
|
|
|
|
expect(page).to have_content 'Can run untagged jobs No'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2020-07-28 23:09:34 +05:30
|
|
|
|
|
|
|
context 'group with a multi-project runner' do
|
|
|
|
let(:project) { create(:project, group: group) }
|
|
|
|
let(:project_2) { create(:project, group: group) }
|
|
|
|
let!(:runner) { create(:ci_runner, :project, projects: [project, project_2], description: 'group-runner') }
|
|
|
|
|
|
|
|
it 'user cannot remove the project runner' do
|
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
|
|
|
expect(all(:link, href: group_runner_path(group, runner)).length).to eq(1)
|
|
|
|
end
|
|
|
|
end
|
2020-10-24 23:57:45 +05:30
|
|
|
|
|
|
|
context 'filtered search' do
|
|
|
|
it 'allows user to search by status and type', :js do
|
|
|
|
visit group_settings_ci_cd_path(group)
|
|
|
|
|
|
|
|
find('.filtered-search').click
|
|
|
|
|
|
|
|
page.within('#js-dropdown-hint') do
|
|
|
|
expect(page).to have_content('Status')
|
|
|
|
expect(page).to have_content('Type')
|
|
|
|
expect(page).not_to have_content('Tag')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|