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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
13d51985
Commit
13d51985
authored
Mar 07, 2022
by
Allison Browne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test coverage for interruptible with child pipelines
parent
9ec1872a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
9 deletions
+43
-9
spec/lib/gitlab/ci/pipeline/chain/cancel_pending_pipelines_spec.rb
...gitlab/ci/pipeline/chain/cancel_pending_pipelines_spec.rb
+43
-9
No files found.
spec/lib/gitlab/ci/pipeline/chain/cancel_pending_pipelines_spec.rb
View file @
13d51985
...
...
@@ -55,31 +55,65 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::CancelPendingPipelines do
context
'when the previous pipeline has a child pipeline'
do
let
(
:child_pipeline
)
{
create
(
:ci_pipeline
,
child_of:
prev_pipeline
)
}
context
'when the child pipeline has
an interruptible job
'
do
context
'when the child pipeline has
only interruptible running jobs
'
do
before
do
create
(
:ci_build
,
:interruptible
,
:running
,
pipeline:
child_pipeline
)
create
(
:ci_build
,
:interruptible
,
:running
,
pipeline:
child_pipeline
)
end
it
'cancels
interruptible builds of child pipeline
'
do
expect
(
build_statuses
(
child_pipeline
)).
to
contain_exactly
(
'running'
)
it
'cancels
all child pipeline builds
'
do
expect
(
build_statuses
(
child_pipeline
)).
to
contain_exactly
(
'running'
,
'running'
)
perform
expect
(
build_statuses
(
child_pipeline
)).
to
contain_exactly
(
'canceled'
)
expect
(
build_statuses
(
child_pipeline
)).
to
contain_exactly
(
'canceled'
,
'canceled'
)
end
context
'when the child pipeline includes completed interruptible jobs'
do
before
do
create
(
:ci_build
,
:interruptible
,
:failed
,
pipeline:
child_pipeline
)
create
(
:ci_build
,
:interruptible
,
:success
,
pipeline:
child_pipeline
)
end
it
'cancels all child pipeline builds with a cancelable_status'
do
expect
(
build_statuses
(
child_pipeline
)).
to
contain_exactly
(
'running'
,
'running'
,
'failed'
,
'success'
)
perform
expect
(
build_statuses
(
child_pipeline
)).
to
contain_exactly
(
'canceled'
,
'canceled'
,
'failed'
,
'success'
)
end
end
end
context
'when the child pipeline has
not an
interruptible job'
do
context
'when the child pipeline has
started non-
interruptible job'
do
before
do
create
(
:ci_build
,
:running
,
pipeline:
child_pipeline
)
create
(
:ci_build
,
:interruptible
,
:running
,
pipeline:
child_pipeline
)
# non-iterruptible started
create
(
:ci_build
,
:success
,
pipeline:
child_pipeline
)
end
it
'does not cancel any child pipeline builds'
do
expect
(
build_statuses
(
child_pipeline
)).
to
contain_exactly
(
'running'
,
'success'
)
perform
expect
(
build_statuses
(
child_pipeline
)).
to
contain_exactly
(
'running'
,
'success'
)
end
end
context
'when the child pipeline has non-interruptible non-started job'
do
before
do
create
(
:ci_build
,
:interruptible
,
:running
,
pipeline:
child_pipeline
)
# non-iterruptible but non-started
create
(
:ci_build
,
:created
,
pipeline:
child_pipeline
)
end
it
'
does not cancel the build of child pipeline
'
do
expect
(
build_statuses
(
child_pipeline
)).
to
contain_exactly
(
'running'
)
it
'
cancels all child pipeline builds
'
do
expect
(
build_statuses
(
child_pipeline
)).
to
contain_exactly
(
'running'
,
'created'
)
perform
expect
(
build_statuses
(
child_pipeline
)).
to
contain_exactly
(
'
running
'
)
expect
(
build_statuses
(
child_pipeline
)).
to
contain_exactly
(
'
canceled'
,
'canceled
'
)
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