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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
1d27bf92
Commit
1d27bf92
authored
Feb 28, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add YAML integration tests for pipeline expressions
parent
51727377
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
spec/lib/gitlab/ci/yaml_processor_spec.rb
spec/lib/gitlab/ci/yaml_processor_spec.rb
+24
-0
No files found.
spec/lib/gitlab/ci/yaml_processor_spec.rb
View file @
1d27bf92
...
@@ -213,6 +213,22 @@ module Gitlab
...
@@ -213,6 +213,22 @@ module Gitlab
end
end
end
end
end
end
context
'when variables policy is specified'
do
let
(
:config
)
do
YAML
.
dump
(
unit:
{
script:
'minitest'
,
only:
{
variables:
[
'$CI_PIPELINE_SOURCE'
]
}
},
feature:
{
script:
'spinach'
,
only:
{
variables:
[
'$UNDEFINED'
]
}
})
end
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
)
}
it
'returns stage seeds only when variables expression is truthy'
do
seeds
=
subject
.
stage_seeds
(
pipeline
)
expect
(
seeds
.
size
).
to
eq
1
expect
(
seeds
.
first
.
builds
.
dig
(
0
,
:name
)).
to
eq
'unit'
end
end
end
end
describe
"#pipeline_stage_builds"
do
describe
"#pipeline_stage_builds"
do
...
@@ -1677,6 +1693,14 @@ module Gitlab
...
@@ -1677,6 +1693,14 @@ module Gitlab
Gitlab
::
Ci
::
YamlProcessor
.
new
(
config
)
Gitlab
::
Ci
::
YamlProcessor
.
new
(
config
)
end
.
to
raise_error
(
Gitlab
::
Ci
::
YamlProcessor
::
ValidationError
,
"jobs:rspec dependencies should be an array of strings"
)
end
.
to
raise_error
(
Gitlab
::
Ci
::
YamlProcessor
::
ValidationError
,
"jobs:rspec dependencies should be an array of strings"
)
end
end
it
'returns errors if pipeline variables expression is invalid'
do
config
=
YAML
.
dump
({
rspec:
{
script:
'test'
,
only:
{
variables:
[
'== null'
]
}
}
})
expect
{
Gitlab
::
Ci
::
YamlProcessor
.
new
(
config
)
}
.
to
raise_error
(
Gitlab
::
Ci
::
YamlProcessor
::
ValidationError
,
'jobs:rspec:only variables invalid expression syntax: equals null'
)
end
end
end
describe
"Validate configuration templates"
do
describe
"Validate configuration templates"
do
...
...
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