Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
a3c07455
Commit
a3c07455
authored
Jun 06, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Collect errors from all nodes in new CI config
parent
6dbd1c86
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
5 deletions
+38
-5
lib/gitlab/ci/config/node/entry.rb
lib/gitlab/ci/config/node/entry.rb
+15
-3
spec/lib/gitlab/ci/config/node/global_spec.rb
spec/lib/gitlab/ci/config/node/global_spec.rb
+23
-2
No files found.
lib/gitlab/ci/config/node/entry.rb
View file @
a3c07455
...
...
@@ -5,7 +5,7 @@ module Gitlab
class
Entry
include
Config
::
ValidationHelpers
attr_reader
:value
,
:
config
,
:parent
,
:nodes
,
:errors
attr_reader
:value
,
:
parent
def
initialize
(
value
,
config
,
parent
=
nil
)
@value
=
value
...
...
@@ -21,8 +21,20 @@ module Gitlab
@nodes
[
key
]
=
entry
.
new
(
@value
[
key
],
config
,
self
)
end
@nodes
.
values
.
each
(
&
:process!
)
@nodes
.
values
.
each
(
&
:validate!
)
nodes
.
each
(
&
:process!
)
nodes
.
each
(
&
:validate!
)
end
def
errors
@errors
+
nodes
.
map
(
&
:errors
).
flatten
end
def
valid?
errors
.
none?
end
def
nodes
@nodes
.
values
end
def
keys
...
...
spec/lib/gitlab/ci/config/node/global_spec.rb
View file @
a3c07455
...
...
@@ -19,7 +19,7 @@ describe Gitlab::Ci::Config::Node::Global do
before
{
global
.
process!
}
it
'creates nodes hash'
do
expect
(
global
.
nodes
).
to
be_a
Hash
expect
(
global
.
nodes
).
to
be_a
n
Array
end
it
'creates node object for each entry'
do
...
...
@@ -27,9 +27,30 @@ describe Gitlab::Ci::Config::Node::Global do
end
it
'creates node object using valid class'
do
expect
(
global
.
nodes
[
:before_script
]
)
expect
(
global
.
nodes
.
first
)
.
to
be_an_instance_of
Gitlab
::
Ci
::
Config
::
Node
::
BeforeScript
end
end
end
context
'when hash is not valid'
do
let
(
:hash
)
do
{
before_script:
'ls'
}
end
before
{
global
.
process!
}
describe
'#valid?'
do
it
'is not valid'
do
expect
(
global
).
not_to
be_valid
end
end
describe
'#errors'
do
it
'reports errors from child nodes'
do
expect
(
global
.
errors
)
.
to
include
'before_script should be an array of strings'
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment