Commit eedebb2b authored by Grzegorz Bizon's avatar Grzegorz Bizon

Improve specs and error messages in extendable config

parent 7efef550
......@@ -50,7 +50,7 @@ module Gitlab
if unknown_extension?
raise Entry::InvalidExtensionError,
"#{key}: unknown `extends` key"
"#{key}: unknown key in `extends`"
end
if invalid_base?
......@@ -60,7 +60,7 @@ module Gitlab
if nesting_too_deep?
raise Entry::NestingTooDeepError,
"#{key}: `extends` nesting too deep"
"#{key}: nesting too deep in `extends`"
end
if circular_dependency?
......
......@@ -139,7 +139,7 @@ describe Gitlab::Ci::Config::Extendable::Entry do
it 'raises an error' do
expect { subject.extend! }
.to raise_error(described_class::InvalidExtensionError,
/unknown `extends` key/)
/unknown key/)
end
end
......
......@@ -80,9 +80,19 @@ describe Gitlab::Ci::Config::Extendable do
only: { refs: %w[master] }
},
build: {
extends: 'something',
stage: 'build'
},
deploy: {
stage: 'deploy',
extends: '.first'
},
something: {
extends: '.first',
script: 'deploy',
script: 'exec',
only: { variables: %w[$SOMETHING] }
},
......@@ -102,7 +112,24 @@ describe Gitlab::Ci::Config::Extendable do
something: {
extends: '.first',
script: 'deploy',
script: 'exec',
only: {
kubernetes: 'active',
variables: %w[$SOMETHING]
}
},
deploy: {
script: 'run',
stage: 'deploy',
only: { kubernetes: 'active' },
extends: '.first'
},
build: {
extends: 'something',
script: 'exec',
stage: 'build',
only: {
kubernetes: 'active',
variables: %w[$SOMETHING]
......
......@@ -1367,7 +1367,7 @@ module Gitlab
expect { Gitlab::Ci::YamlProcessor.new(config) }
.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError,
'rspec: unknown `extends` key')
'rspec: unknown key in `extends`')
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment