Change CI/CD kubernetes policy keyword to active

This commit is contained in:
Grzegorz Bizon 2017-09-01 13:03:43 +02:00
parent 73d0cafbe4
commit fc4fb6e4d2
4 changed files with 10 additions and 16 deletions

View file

@ -33,7 +33,7 @@ module Gitlab
with_options allow_nil: true do with_options allow_nil: true do
validates :refs, array_of_strings_or_regexps: true validates :refs, array_of_strings_or_regexps: true
validates :kubernetes, allowed_values: %w[configured] validates :kubernetes, allowed_values: %w[active]
end end
end end
end end

View file

@ -172,20 +172,14 @@ module Ci
YAML.dump( YAML.dump(
spinach: { stage: 'test', script: 'spinach' }, spinach: { stage: 'test', script: 'spinach' },
production: { stage: 'deploy', script: 'cap', only: { production: { stage: 'deploy', script: 'cap', only: {
kubernetes: 'configured' } } kubernetes: 'active' } }
) )
end end
context 'when kubernetes is configured' do context 'when kubernetes is active' do
let(:project) { create(:kubernetes_project) } let(:project) { create(:kubernetes_project) }
let(:pipeline) { create(:ci_empty_pipeline, project: project) } let(:pipeline) { create(:ci_empty_pipeline, project: project) }
before do
create(:ci_variable, key: 'KUBE_DOMAIN',
protected: false,
project: project)
end
it 'returns seeds for kubernetes dependent job' do it 'returns seeds for kubernetes dependent job' do
seeds = subject.stage_seeds(pipeline) seeds = subject.stage_seeds(pipeline)
@ -195,7 +189,7 @@ module Ci
end end
end end
context 'when kubernetes is not configured' do context 'when kubernetes is not active' do
it 'does not return seeds for kubernetes dependent job' do it 'does not return seeds for kubernetes dependent job' do
seeds = subject.stage_seeds(pipeline) seeds = subject.stage_seeds(pipeline)

View file

@ -67,19 +67,19 @@ describe Gitlab::Ci::Config::Entry::Policy do
end end
context 'when specifying kubernetes policy' do context 'when specifying kubernetes policy' do
let(:config) { { kubernetes: 'configured' } } let(:config) { { kubernetes: 'active' } }
it 'is a correct configuraton' do it 'is a correct configuraton' do
expect(entry).to be_valid expect(entry).to be_valid
expect(entry.value).to eq(kubernetes: 'configured') expect(entry.value).to eq(kubernetes: 'active')
end end
end end
context 'when specifying invalid kubernetes policy' do context 'when specifying invalid kubernetes policy' do
let(:config) { { kubernetes: 'active' } } let(:config) { { kubernetes: 'something' } }
it 'reports an error about invalid policy' do it 'reports an error about invalid policy' do
expect(entry.errors).to include /unknown value: active/ expect(entry.errors).to include /unknown value: something/
end end
end end

View file

@ -547,7 +547,7 @@ describe Ci::Pipeline, :mailer do
end end
describe '#has_kubernetes_active?' do describe '#has_kubernetes_active?' do
context 'when kubernetes is configured' do context 'when kubernetes is active' do
let(:project) { create(:kubernetes_project) } let(:project) { create(:kubernetes_project) }
it 'returns true' do it 'returns true' do
@ -555,7 +555,7 @@ describe Ci::Pipeline, :mailer do
end end
end end
context 'when kubernetes is not configured' do context 'when kubernetes is not active' do
it 'returns false' do it 'returns false' do
expect(pipeline).not_to have_kubernetes_active expect(pipeline).not_to have_kubernetes_active
end end