BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
3e75fd6c
Unverified
Commit
3e75fd6c
authored
Jun 12, 2017
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve specs for GitlabCiYamlProcessor
parent
7805eea3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
105 additions
and
50 deletions
+105
-50
gitlab_ci_yaml_processor_spec.rb
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+105
-50
No files found.
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
View file @
3e75fd6c
...
...
@@ -596,62 +596,117 @@ module Ci
end
describe
"Image and service handling"
do
it
"returns image and service when defined"
do
config
=
YAML
.
dump
({
image:
{
name:
"ruby:2.1"
},
services:
[
"mysql"
,
{
name:
"docker:dind"
,
alias:
"docker"
}],
before_script:
[
"pwd"
],
rspec:
{
script:
"rspec"
}
})
context
"when extended docker configuration is used"
do
it
"returns image and service when defined"
do
config
=
YAML
.
dump
({
image:
{
name:
"ruby:2.1"
},
services:
[
"mysql"
,
{
name:
"docker:dind"
,
alias:
"docker"
}],
before_script:
[
"pwd"
],
rspec:
{
script:
"rspec"
}
})
config_processor
=
GitlabCiYamlProcessor
.
new
(
config
,
path
)
config_processor
=
GitlabCiYamlProcessor
.
new
(
config
,
path
)
expect
(
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
size
).
to
eq
(
1
)
expect
(
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
first
).
to
eq
({
stage:
"test"
,
stage_idx:
1
,
name:
"rspec"
,
commands:
"pwd
\n
rspec"
,
coverage_regex:
nil
,
tag_list:
[],
options:
{
image:
{
name:
"ruby:2.1"
},
services:
[{
name:
"mysql"
},
{
name:
"docker:dind"
,
alias:
"docker"
}]
},
allow_failure:
false
,
when:
"on_success"
,
environment:
nil
,
yaml_variables:
[]
})
expect
(
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
size
).
to
eq
(
1
)
expect
(
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
first
).
to
eq
({
stage:
"test"
,
stage_idx:
1
,
name:
"rspec"
,
commands:
"pwd
\n
rspec"
,
coverage_regex:
nil
,
tag_list:
[],
options:
{
image:
{
name:
"ruby:2.1"
},
services:
[{
name:
"mysql"
},
{
name:
"docker:dind"
,
alias:
"docker"
}]
},
allow_failure:
false
,
when:
"on_success"
,
environment:
nil
,
yaml_variables:
[]
})
end
it
"returns image and service when overridden for job"
do
config
=
YAML
.
dump
({
image:
"ruby:2.1"
,
services:
[
"mysql"
],
before_script:
[
"pwd"
],
rspec:
{
image:
{
name:
"ruby:2.5"
},
services:
[{
name:
"postgresql"
,
alias:
"db-pg"
},
"docker:dind"
],
script:
"rspec"
}
})
config_processor
=
GitlabCiYamlProcessor
.
new
(
config
,
path
)
expect
(
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
size
).
to
eq
(
1
)
expect
(
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
first
).
to
eq
({
stage:
"test"
,
stage_idx:
1
,
name:
"rspec"
,
commands:
"pwd
\n
rspec"
,
coverage_regex:
nil
,
tag_list:
[],
options:
{
image:
{
name:
"ruby:2.5"
},
services:
[{
name:
"postgresql"
,
alias:
"db-pg"
},
{
name:
"docker:dind"
}]
},
allow_failure:
false
,
when:
"on_success"
,
environment:
nil
,
yaml_variables:
[]
})
end
end
it
"returns image and service when overridden for job"
do
config
=
YAML
.
dump
({
image:
"ruby:2.1"
,
services:
[
"mysql"
],
before_script:
[
"pwd"
],
rspec:
{
image:
"ruby:2.5"
,
services:
[{
name:
"postgresql"
},
"docker:dind"
],
script:
"rspec"
}
})
context
"when etended docker configuration is not used"
do
it
"returns image and service when defined"
do
config
=
YAML
.
dump
({
image:
"ruby:2.1"
,
services:
[
"mysql"
,
"docker:dind"
],
before_script:
[
"pwd"
],
rspec:
{
script:
"rspec"
}
})
config_processor
=
GitlabCiYamlProcessor
.
new
(
config
,
path
)
config_processor
=
GitlabCiYamlProcessor
.
new
(
config
,
path
)
expect
(
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
size
).
to
eq
(
1
)
expect
(
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
first
).
to
eq
({
stage:
"test"
,
stage_idx:
1
,
name:
"rspec"
,
commands:
"pwd
\n
rspec"
,
coverage_regex:
nil
,
tag_list:
[],
options:
{
image:
{
name:
"ruby:2.5"
},
services:
[{
name:
"postgresql"
},
{
name:
"docker:dind"
}]
},
allow_failure:
false
,
when:
"on_success"
,
environment:
nil
,
yaml_variables:
[]
})
expect
(
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
size
).
to
eq
(
1
)
expect
(
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
first
).
to
eq
({
stage:
"test"
,
stage_idx:
1
,
name:
"rspec"
,
commands:
"pwd
\n
rspec"
,
coverage_regex:
nil
,
tag_list:
[],
options:
{
image:
{
name:
"ruby:2.1"
},
services:
[{
name:
"mysql"
},
{
name:
"docker:dind"
}]
},
allow_failure:
false
,
when:
"on_success"
,
environment:
nil
,
yaml_variables:
[]
})
end
it
"returns image and service when overridden for job"
do
config
=
YAML
.
dump
({
image:
"ruby:2.1"
,
services:
[
"mysql"
],
before_script:
[
"pwd"
],
rspec:
{
image:
"ruby:2.5"
,
services:
[
"postgresql"
,
"docker:dind"
],
script:
"rspec"
}
})
config_processor
=
GitlabCiYamlProcessor
.
new
(
config
,
path
)
expect
(
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
size
).
to
eq
(
1
)
expect
(
config_processor
.
builds_for_stage_and_ref
(
"test"
,
"master"
).
first
).
to
eq
({
stage:
"test"
,
stage_idx:
1
,
name:
"rspec"
,
commands:
"pwd
\n
rspec"
,
coverage_regex:
nil
,
tag_list:
[],
options:
{
image:
{
name:
"ruby:2.5"
},
services:
[{
name:
"postgresql"
},
{
name:
"docker:dind"
}]
},
allow_failure:
false
,
when:
"on_success"
,
environment:
nil
,
yaml_variables:
[]
})
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