2016-07-20 08:33:13 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-04-06 08:40:33 -04:00
|
|
|
describe "Projects > Settings > Pipelines settings" do
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project) }
|
2016-07-20 08:33:13 -04:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:role) { :developer }
|
|
|
|
|
2018-04-06 08:40:33 -04:00
|
|
|
before do
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2017-12-22 03:18:28 -05:00
|
|
|
project.add_role(user, role)
|
2018-04-12 11:51:25 -04:00
|
|
|
create(:project_auto_devops, project: project)
|
2016-07-20 08:33:13 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'for developer' do
|
2018-04-06 08:40:33 -04:00
|
|
|
let(:role) { :developer }
|
2016-07-20 08:33:13 -04:00
|
|
|
|
2018-04-06 08:40:33 -04:00
|
|
|
it 'to be disallowed to view' do
|
2017-11-20 11:40:01 -05:00
|
|
|
visit project_settings_ci_cd_path(project)
|
|
|
|
|
2016-07-20 08:33:13 -04:00
|
|
|
expect(page.status_code).to eq(404)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'for master' do
|
2018-04-06 08:40:33 -04:00
|
|
|
let(:role) { :master }
|
2016-07-20 08:33:13 -04:00
|
|
|
|
2018-04-06 08:40:33 -04:00
|
|
|
it 'be allowed to change' do
|
2017-11-20 11:40:01 -05:00
|
|
|
visit project_settings_ci_cd_path(project)
|
|
|
|
|
2016-07-20 08:33:13 -04:00
|
|
|
fill_in('Test coverage parsing', with: 'coverage_regex')
|
2018-04-12 11:51:25 -04:00
|
|
|
|
2018-04-17 12:37:16 -04:00
|
|
|
page.within '#js-general-pipeline-settings' do
|
2018-04-11 13:04:35 -04:00
|
|
|
click_on 'Save changes'
|
|
|
|
end
|
2016-07-20 08:33:13 -04:00
|
|
|
|
|
|
|
expect(page.status_code).to eq(200)
|
2018-04-12 11:51:25 -04:00
|
|
|
|
2018-04-17 12:37:16 -04:00
|
|
|
page.within '#js-general-pipeline-settings' do
|
2018-04-11 13:04:35 -04:00
|
|
|
expect(page).to have_button('Save changes', disabled: false)
|
|
|
|
end
|
2018-04-12 11:51:25 -04:00
|
|
|
|
2016-07-20 08:33:13 -04:00
|
|
|
expect(page).to have_field('Test coverage parsing', with: 'coverage_regex')
|
|
|
|
end
|
2017-04-05 14:21:31 -04:00
|
|
|
|
2018-04-06 08:40:33 -04:00
|
|
|
it 'updates auto_cancel_pending_pipelines' do
|
2017-11-20 11:40:01 -05:00
|
|
|
visit project_settings_ci_cd_path(project)
|
|
|
|
|
2017-04-05 14:21:31 -04:00
|
|
|
page.check('Auto-cancel redundant, pending pipelines')
|
2018-04-17 12:37:16 -04:00
|
|
|
page.within '#js-general-pipeline-settings' do
|
2018-04-11 13:04:35 -04:00
|
|
|
click_on 'Save changes'
|
|
|
|
end
|
2017-04-05 14:21:31 -04:00
|
|
|
|
|
|
|
expect(page.status_code).to eq(200)
|
2018-04-12 11:51:25 -04:00
|
|
|
|
2018-04-17 12:37:16 -04:00
|
|
|
page.within '#js-general-pipeline-settings' do
|
2018-04-11 13:04:35 -04:00
|
|
|
expect(page).to have_button('Save changes', disabled: false)
|
|
|
|
end
|
2017-04-05 14:21:31 -04:00
|
|
|
|
|
|
|
checkbox = find_field('project_auto_cancel_pending_pipelines')
|
|
|
|
expect(checkbox).to be_checked
|
|
|
|
end
|
2017-09-04 03:27:09 -04:00
|
|
|
|
2017-11-20 11:40:01 -05:00
|
|
|
describe 'Auto DevOps' do
|
|
|
|
it 'update auto devops settings' do
|
|
|
|
visit project_settings_ci_cd_path(project)
|
2017-09-04 03:27:09 -04:00
|
|
|
|
2018-04-17 12:37:16 -04:00
|
|
|
page.within '#autodevops-settings' do
|
2018-04-11 13:04:35 -04:00
|
|
|
fill_in('project_auto_devops_attributes_domain', with: 'test.com')
|
|
|
|
page.choose('project_auto_devops_attributes_enabled_false')
|
|
|
|
click_on 'Save changes'
|
|
|
|
end
|
2017-11-20 11:40:01 -05:00
|
|
|
|
|
|
|
expect(page.status_code).to eq(200)
|
|
|
|
expect(project.auto_devops).to be_present
|
|
|
|
expect(project.auto_devops).not_to be_enabled
|
2018-04-12 11:51:25 -04:00
|
|
|
expect(project.auto_devops.domain).to eq('test.com')
|
2017-11-20 11:40:01 -05:00
|
|
|
end
|
2018-04-20 00:17:00 -04:00
|
|
|
|
|
|
|
context 'when there is a cluster with ingress and external_ip' do
|
|
|
|
before do
|
|
|
|
cluster = create(:cluster, projects: [project])
|
|
|
|
cluster.create_application_ingress!(external_ip: '192.168.1.100')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows the help text with the nip.io domain as an alternative to custom domain' do
|
|
|
|
visit project_settings_ci_cd_path(project)
|
|
|
|
expect(page).to have_content('192.168.1.100.nip.io can be used as an alternative to a custom domain')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when there is no ingress' do
|
|
|
|
before do
|
|
|
|
create(:cluster, projects: [project])
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'alternative to custom domain is not shown' do
|
|
|
|
visit project_settings_ci_cd_path(project)
|
|
|
|
expect(page).not_to have_content('can be used as an alternative to a custom domain')
|
|
|
|
end
|
|
|
|
end
|
2017-09-04 03:27:09 -04:00
|
|
|
end
|
2016-07-20 08:33:13 -04:00
|
|
|
end
|
|
|
|
end
|