提交 6d3ab5d8 编写于 作者: K Kamil Trzciński

Merge branch 'ce-fj-11886-fix-port-validation' into 'master'

Fix port validations in .gitlab-webide.yml

See merge request gitlab-org/gitlab-ce!29016
...@@ -24,7 +24,7 @@ module Gitlab ...@@ -24,7 +24,7 @@ module Gitlab
end end
entry :ports, Entry::Ports, entry :ports, Entry::Ports,
description: 'Ports used expose the image' description: 'Ports used to expose the image'
attributes :ports attributes :ports
......
...@@ -24,6 +24,9 @@ module Gitlab ...@@ -24,6 +24,9 @@ module Gitlab
validates :alias, type: String, presence: true, unless: ->(record) { record.ports.blank? } validates :alias, type: String, presence: true, unless: ->(record) { record.ports.blank? }
end end
entry :ports, Entry::Ports,
description: 'Ports used to expose the service'
def alias def alias
value[:alias] value[:alias]
end end
......
...@@ -112,6 +112,16 @@ describe Gitlab::Ci::Config::Entry::Service do ...@@ -112,6 +112,16 @@ describe Gitlab::Ci::Config::Entry::Service do
it 'is valid' do it 'is valid' do
expect(entry).to be_valid expect(entry).to be_valid
end end
context 'when unknown port keys detected' do
let(:ports) { [{ number: 80, invalid_key: 'foo' }] }
it 'is not valid' do
expect(entry).not_to be_valid
expect(entry.errors.first)
.to match /port config contains unknown keys: invalid_key/
end
end
end end
describe '#ports' do describe '#ports' do
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册