diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-08-26 12:45:36 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-08-26 12:45:36 +0200 |
commit | 326dc7da3bb7e6537095277dc8ee8ae880774b62 (patch) | |
tree | a7975f8850f5cef9fc706de3a05a7bbd49f8da82 /spec/models/ci/pipeline_spec.rb | |
parent | ae99f74b77fc0f49a9efd5f71119e7de4e313629 (diff) | |
download | gitlab-ce-326dc7da3bb7e6537095277dc8ee8ae880774b62.tar.gz |
Check if kubernetes required before creating a job
Diffstat (limited to 'spec/models/ci/pipeline_spec.rb')
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index eea494a22b6..b298b0b1354 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -542,6 +542,46 @@ describe Ci::Pipeline, :mailer do end end + context 'when kubernetes is configured' do + let(:project) { create(:kubernetes_project) } + + before do + create(:ci_variable, key: 'KUBE_DOMAIN', + protected: false, + project: project) + end + + describe '#variables' do + it 'returns kubernetes-related variables' do + variables = pipeline.variables.map { |v| v.fetch(:key) } + + expect(variables).to include 'KUBECONFIG', 'KUBE_DOMAIN' + end + end + + describe '#has_kubernetes_available?' do + it 'returns true' do + expect(pipeline).to have_kubernetes_available + end + end + end + + context 'when kubernetes is not configured' do + describe '#variables' do + it 'does not return kubernetes related variables' do + variables = pipeline.variables.map { |v| v.fetch(:key) } + + expect(variables).not_to include 'KUBECONFIG', 'KUBE_DOMAIN' + end + end + + describe '#has_kubernetes_available?' do + it 'returns false' do + expect(pipeline).not_to have_kubernetes_available + end + end + end + describe '#has_stage_seeds?' do context 'when pipeline has stage seeds' do subject { build(:ci_pipeline_with_one_job) } |