summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/ci/yaml_processor_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-11-18 13:16:36 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-18 13:16:36 +0000
commit311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch)
tree07e7870bca8aed6d61fdcc810731c50d2c40af47 /spec/lib/gitlab/ci/yaml_processor_spec.rb
parent27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff)
downloadgitlab-ce-311b0269b4eb9839fa63f80c8d7a58f32b8138a0.tar.gz
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'spec/lib/gitlab/ci/yaml_processor_spec.rb')
-rw-r--r--spec/lib/gitlab/ci/yaml_processor_spec.rb58
1 files changed, 58 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/yaml_processor_spec.rb b/spec/lib/gitlab/ci/yaml_processor_spec.rb
index 1591c2e6b60..f00a801286d 100644
--- a/spec/lib/gitlab/ci/yaml_processor_spec.rb
+++ b/spec/lib/gitlab/ci/yaml_processor_spec.rb
@@ -1046,6 +1046,64 @@ module Gitlab
end
end
+ context 'when overriding `extends`' do
+ let(:config) do
+ <<~YAML
+ .base:
+ script: test
+ variables:
+ VAR1: base var 1
+
+ test1:
+ extends: .base
+ variables:
+ VAR1: test1 var 1
+ VAR2: test2 var 2
+
+ test2:
+ extends: .base
+ variables:
+ VAR2: test2 var 2
+
+ test3:
+ extends: .base
+ variables: {}
+
+ test4:
+ extends: .base
+ variables: null
+ YAML
+ end
+
+ it 'correctly extends jobs' do
+ expect(config_processor.builds[0]).to include(
+ name: 'test1',
+ options: { script: ['test'] },
+ job_variables: [{ key: 'VAR1', value: 'test1 var 1', public: true },
+ { key: 'VAR2', value: 'test2 var 2', public: true }]
+ )
+
+ expect(config_processor.builds[1]).to include(
+ name: 'test2',
+ options: { script: ['test'] },
+ job_variables: [{ key: 'VAR1', value: 'base var 1', public: true },
+ { key: 'VAR2', value: 'test2 var 2', public: true }]
+ )
+
+ expect(config_processor.builds[2]).to include(
+ name: 'test3',
+ options: { script: ['test'] },
+ job_variables: [{ key: 'VAR1', value: 'base var 1', public: true }]
+ )
+
+ expect(config_processor.builds[3]).to include(
+ name: 'test4',
+ options: { script: ['test'] },
+ job_variables: []
+ )
+ end
+ end
+
context 'when using recursive `extends`' do
let(:config) do
<<~YAML