diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-08-31 14:56:25 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-08-31 14:56:25 +0200 |
commit | ef030709ebffdecdce67f2693d8c54669edfb7a7 (patch) | |
tree | c1115d74b7aa6c56150e97e05360d1c71e7ac3dc /spec/lib/gitlab | |
parent | 92673c2c63c5928279fdb1985357fa8596c97397 (diff) | |
download | gitlab-ce-ef030709ebffdecdce67f2693d8c54669edfb7a7.tar.gz |
Change kubernetes job policy allowed values
It is now possible to use `kubernetes: configured`.
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/policy_spec.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/config/entry/policy_spec.rb b/spec/lib/gitlab/ci/config/entry/policy_spec.rb index ab69a2e8bcc..a5c2e3f1989 100644 --- a/spec/lib/gitlab/ci/config/entry/policy_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/policy_spec.rb @@ -56,6 +56,50 @@ describe Gitlab::Ci::Config::Entry::Policy do end end + context 'when using complex policy' do + context 'when specifiying refs policy' do + let(:config) { { refs: ['master'] } } + + it 'is a correct configuraton' do + expect(entry).to be_valid + expect(entry.value).to eq(refs: %w[master]) + end + end + + context 'when specifying kubernetes policy' do + let(:config) { { kubernetes: 'configured' } } + + it 'is a correct configuraton' do + expect(entry).to be_valid + expect(entry.value).to eq(kubernetes: 'configured') + end + end + + context 'when specifying invalid kubernetes policy' do + let(:config) { { kubernetes: 'active' } } + + it 'reports an error about invalid policy' do + expect(entry.errors).to include /unknown value: active/ + end + end + + context 'when specifying unknown policy' do + let(:config) { { refs: ['master'], invalid: :something } } + + it 'returns error about invalid key' do + expect(entry.errors).to include /unknown keys: invalid/ + end + end + + context 'when policy is empty' do + let(:config) { {} } + + it 'is not a valid configuration' do + expect(entry.errors).to include /can't be blank/ + end + end + end + context 'when policy strategy does not match' do let(:config) { 'string strategy' } |