Commit 823970b5 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Fix ci config cache validation in legacy processor

parent 1f320edb
......@@ -127,8 +127,8 @@ module Ci
def validate_global_cache!
@cache.keys.each do |key|
unless ALLOWED_CACHE_KEYS.include? key
raise ValidationError, "#{name} cache unknown parameter #{key}"
unless ALLOWED_CACHE_KEYS.include?(key)
raise ValidationError, "Cache config has unknown parameter: #{key}"
end
end
......
......@@ -591,7 +591,20 @@ module Ci
end
end
describe "Caches" do
describe 'cache' do
context 'when cache definition has unknown keys' do
it 'raises relevant validation error' do
config = YAML.dump(
{ cache: { untracked: true, invalid: 'key' },
rspec: { script: 'rspec' } })
expect { GitlabCiYamlProcessor.new(config) }.to raise_error(
GitlabCiYamlProcessor::ValidationError,
'Cache config has unknown parameter: invalid'
)
end
end
it "returns cache when defined globally" do
config = YAML.dump({
cache: { paths: ["logs/", "binaries/"], untracked: true, key: 'key' },
......
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