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
b18afa83
Commit
b18afa83
authored
Aug 19, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test that shows problem with pipeline processing
parent
71db3b1c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
3 deletions
+43
-3
spec/services/ci/process_pipeline_service_spec.rb
spec/services/ci/process_pipeline_service_spec.rb
+43
-3
No files found.
spec/services/ci/process_pipeline_service_spec.rb
View file @
b18afa83
...
...
@@ -3,8 +3,6 @@ require 'spec_helper'
describe
Ci
::
ProcessPipelineService
,
services:
true
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
ref:
'master'
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:all_builds
)
{
pipeline
.
builds
}
let
(
:builds
)
{
all_builds
.
where
.
not
(
status:
[
:created
,
:skipped
])
}
let
(
:config
)
{
nil
}
before
do
...
...
@@ -12,6 +10,14 @@ describe Ci::ProcessPipelineService, services: true do
end
describe
'#execute'
do
def
all_builds
pipeline
.
builds
end
def
builds
all_builds
.
where
.
not
(
status:
[
:created
,
:skipped
])
end
def
create_builds
described_class
.
new
(
pipeline
.
project
,
user
).
execute
(
pipeline
)
end
...
...
@@ -48,7 +54,7 @@ describe Ci::ProcessPipelineService, services: true do
it
'does not process pipeline if existing stage is running'
do
expect
(
create_builds
).
to
be_truthy
expect
(
builds
.
pending
.
count
).
to
eq
(
2
)
expect
(
create_builds
).
to
be_falsey
expect
(
builds
.
pending
.
count
).
to
eq
(
2
)
end
...
...
@@ -224,6 +230,40 @@ describe Ci::ProcessPipelineService, services: true do
end
end
context
'when failed build in the middle stage is retried'
do
context
'when failed build is the only unsuccessful build in the stage'
do
before
do
create
(
:ci_build
,
:created
,
pipeline:
pipeline
,
name:
'build:1'
,
stage_idx:
0
)
create
(
:ci_build
,
:created
,
pipeline:
pipeline
,
name:
'build:2'
,
stage_idx:
0
)
create
(
:ci_build
,
:created
,
pipeline:
pipeline
,
name:
'test:1'
,
stage_idx:
1
)
create
(
:ci_build
,
:created
,
pipeline:
pipeline
,
name:
'test:2'
,
stage_idx:
1
)
create
(
:ci_build
,
:created
,
pipeline:
pipeline
,
name:
'deploy:1'
,
stage_idx:
2
)
create
(
:ci_build
,
:created
,
pipeline:
pipeline
,
name:
'deploy:2'
,
stage_idx:
2
)
end
it
'does trigger builds in the next stage'
do
expect
(
create_builds
).
to
be_truthy
expect
(
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build:1'
,
'build:2'
)
pipeline
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
builds
.
pluck
(
:name
))
.
to
contain_exactly
(
'build:1'
,
'build:2'
,
'test:1'
,
'test:2'
)
pipeline
.
builds
.
find_by
(
name:
'test:1'
).
success
pipeline
.
builds
.
find_by
(
name:
'test:2'
).
drop
expect
(
builds
.
pluck
(
:name
))
.
to
contain_exactly
(
'build:1'
,
'build:2'
,
'test:1'
,
'test:2'
)
Ci
::
Build
.
retry
(
pipeline
.
builds
.
find_by
(
name:
'test:2'
))
expect
(
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build:1'
,
'build:2'
,
'test:1'
,
'test:2'
,
'test:2'
,
'deploy:1'
,
'deploy:2'
)
end
end
end
context
'creates a builds from .gitlab-ci.yml'
do
let
(
:config
)
do
YAML
.
dump
({
...
...
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