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
f7014cd5
Commit
f7014cd5
authored
Apr 06, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test to make sure it's not auto-canceling
whenever the feature is disabled in the project.
parent
e258e6f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
10 deletions
+24
-10
create_pipeline_service_spec.rb
spec/services/ci/create_pipeline_service_spec.rb
+24
-10
No files found.
spec/services/ci/create_pipeline_service_spec.rb
View file @
f7014cd5
...
...
@@ -21,6 +21,12 @@ describe Ci::CreatePipelineService, services: true do
context
'valid params'
do
let
(
:pipeline
)
{
execute_service
}
let
(
:pipeline_on_previous_commit
)
do
execute_service
(
after:
previous_commit_sha_from_ref
(
'master'
)
)
end
it
{
expect
(
pipeline
).
to
be_kind_of
(
Ci
::
Pipeline
)
}
it
{
expect
(
pipeline
).
to
be_valid
}
it
{
expect
(
pipeline
).
to
eq
(
project
.
pipelines
.
last
)
}
...
...
@@ -29,20 +35,10 @@ describe Ci::CreatePipelineService, services: true do
it
{
expect
(
pipeline
.
builds
.
first
).
to
be_kind_of
(
Ci
::
Build
)
}
context
'auto-cancel enabled'
do
let
(
:pipeline_on_previous_commit
)
do
execute_service
(
after:
previous_commit_sha_from_ref
(
'master'
)
)
end
before
do
project
.
update
(
auto_cancel_pending_pipelines:
'enabled'
)
end
def
previous_commit_sha_from_ref
(
ref
)
project
.
commit
(
ref
).
parent
.
sha
end
it
'does not cancel HEAD pipeline'
do
pipeline
pipeline_on_previous_commit
...
...
@@ -81,6 +77,24 @@ describe Ci::CreatePipelineService, services: true do
expect
(
pending_pipeline
.
reload
).
to
have_attributes
(
status:
'pending'
,
auto_canceled_by_id:
nil
)
end
end
context
'auto-cancel disabled'
do
before
do
project
.
update
(
auto_cancel_pending_pipelines:
'disabled'
)
end
it
'does not auto cancel pending non-HEAD pipelines'
do
pipeline_on_previous_commit
pipeline
expect
(
pipeline_on_previous_commit
.
reload
)
.
to
have_attributes
(
status:
'pending'
,
auto_canceled_by_id:
nil
)
end
end
def
previous_commit_sha_from_ref
(
ref
)
project
.
commit
(
ref
).
parent
.
sha
end
end
context
"skip tag if there is no build for it"
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