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
Jérome Perrin
gitlab-ce
Commits
fda61998
Commit
fda61998
authored
Nov 25, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update pipeline processing specs for creating builds
parent
785d5c8e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
35 deletions
+28
-35
spec/services/ci/process_pipeline_service_spec.rb
spec/services/ci/process_pipeline_service_spec.rb
+28
-35
No files found.
spec/services/ci/process_pipeline_service_spec.rb
View file @
fda61998
...
...
@@ -327,62 +327,55 @@ describe Ci::ProcessPipelineService, services: true do
end
end
context
'creates a builds from .gitlab-ci.yml'
do
let
(
:config
)
do
YAML
.
dump
({
rspec:
{
stage:
'test'
,
script:
'rspec'
},
rubocop:
{
stage:
'test'
,
script:
'rubocop'
},
deploy:
{
stage:
'deploy'
,
script:
'deploy'
}
})
end
# Using stubbed .gitlab-ci.yml created in commit factory
#
context
'when there are builds in multiple stages'
do
before
do
stub_ci_pipeline_yaml_file
(
config
)
create
(
:ci_build
,
:created
,
pipeline:
pipeline
,
name:
'linux'
,
stage:
'build'
,
stage_idx:
0
)
create
(
:ci_build
,
:created
,
pipeline:
pipeline
,
name:
'mac'
,
stage:
'build'
,
stage_idx:
0
)
create
(
:ci_build
,
:created
,
pipeline:
pipeline
,
name:
'rspec'
,
stage:
'test'
,
stage_idx:
1
)
create
(
:ci_build
,
:created
,
pipeline:
pipeline
,
name:
'rubocop'
,
stage:
'test'
,
stage_idx:
1
)
create
(
:ci_build
,
:created
,
pipeline:
pipeline
,
name:
'deploy'
,
stage:
'deploy'
,
stage_idx:
2
)
end
it
'when processing a pipeline'
do
# Currently we have two builds with state created
it
'processes the pipeline'
do
# Currently we have five builds with state created
#
expect
(
builds
.
count
).
to
eq
(
0
)
expect
(
all_builds
.
count
).
to
eq
(
2
)
expect
(
all_builds
.
count
).
to
eq
(
5
)
# Process builds will mark the created as pending
#
process_pipeline
# Create builds will mark the created as pending
expect
(
process_pipeline
).
to
be_truthy
expect
(
builds
.
count
).
to
eq
(
2
)
expect
(
all_builds
.
count
).
to
eq
(
2
)
expect
(
all_builds
.
count
).
to
eq
(
5
)
# When we builds succeed we will create a rest of pipeline from .gitlab-ci.yml
# We will have 2 succeeded, 2 pending (from stage test), total 5 (one more build from deploy)
# When builds succeed we will enqueue remaining builds
# We will have 2 succeeded, 2 pending (from stage test),
# total 5 (one more build from deploy)
#
succeed_pending
expect
(
process_pipeline
).
to
be_truthy
process_pipeline
expect
(
builds
.
success
.
count
).
to
eq
(
2
)
expect
(
builds
.
pending
.
count
).
to
eq
(
2
)
expect
(
all_builds
.
count
).
to
eq
(
5
)
# When we succeed the 2 pending from stage test,
# We will queue a deploy stage, no new builds will be created
# We will queue a deploy stage.
#
succeed_pending
expect
(
process_pipeline
).
to
be_truthy
process_pipeline
expect
(
builds
.
pending
.
count
).
to
eq
(
1
)
expect
(
builds
.
success
.
count
).
to
eq
(
4
)
expect
(
all_builds
.
count
).
to
eq
(
5
)
# When we succeed last pending build, we will have a total of 5 succeeded builds, no new builds will be created
# When we succeed last pending build, we will have
# a total of 5 succeeded builds
#
succeed_pending
expect
(
process_pipeline
).
to
be_falsey
process_pipeline
expect
(
builds
.
success
.
count
).
to
eq
(
5
)
expect
(
all_builds
.
count
).
to
eq
(
5
)
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