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
Léo-Paul Géneau
gitlab-ce
Commits
e4554925
Commit
e4554925
authored
Mar 05, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend specs for pipelines with manual blocking actions
parent
57253f04
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
app/models/concerns/has_status.rb
app/models/concerns/has_status.rb
+4
-0
spec/services/ci/process_pipeline_service_spec.rb
spec/services/ci/process_pipeline_service_spec.rb
+59
-0
No files found.
app/models/concerns/has_status.rb
View file @
e4554925
...
@@ -96,6 +96,10 @@ module HasStatus
...
@@ -96,6 +96,10 @@ module HasStatus
COMPLETED_STATUSES
.
include?
(
status
)
COMPLETED_STATUSES
.
include?
(
status
)
end
end
def
blocked?
BLOCKED_STATUS
==
status
end
private
private
def
calculate_duration
def
calculate_duration
...
...
spec/services/ci/process_pipeline_service_spec.rb
View file @
e4554925
...
@@ -312,6 +312,61 @@ describe Ci::ProcessPipelineService, '#execute', :services do
...
@@ -312,6 +312,61 @@ describe Ci::ProcessPipelineService, '#execute', :services do
expect
(
pipeline
.
reload
).
to
be_failed
expect
(
pipeline
.
reload
).
to
be_failed
end
end
end
end
context
'when pipeline is promoted sequentially up to the end'
do
it
'properly processes entire pipeline'
do
process_pipeline
expect
(
builds_names
).
to
eq
%w[code:test]
expect
(
builds_statuses
).
to
eq
%w[pending]
succeed_running_or_pending
expect
(
builds_names
).
to
eq
%w[code:test staging:deploy]
expect
(
builds_statuses
).
to
eq
%w[success manual]
expect
(
pipeline
.
reload
).
to
be_manual
play_manual_action
(
'staging:deploy'
)
expect
(
builds_statuses
).
to
eq
%w[success pending]
succeed_running_or_pending
expect
(
builds_names
).
to
eq
%w[code:test staging:deploy staging:test]
expect
(
builds_statuses
).
to
eq
%w[success success pending]
succeed_running_or_pending
expect
(
builds_names
).
to
eq
%w[code:test staging:deploy staging:test
production:deploy]
expect
(
builds_statuses
).
to
eq
%w[success success success manual]
expect
(
pipeline
.
reload
).
to
be_manual
# TODO, expect(pipeline.reload).to be_started
expect
(
pipeline
.
reload
).
to
be_blocked
expect
(
pipeline
.
reload
).
not_to
be_active
expect
(
pipeline
.
reload
).
not_to
be_complete
play_manual_action
(
'production:deploy'
)
expect
(
builds_statuses
).
to
eq
%w[success success success pending]
expect
(
pipeline
.
reload
).
to
be_running
succeed_running_or_pending
expect
(
builds_names
).
to
eq
%w[code:test staging:deploy staging:test
production:deploy production:test]
expect
(
builds_statuses
).
to
eq
%w[success success success success pending]
expect
(
pipeline
.
reload
).
to
be_running
succeed_running_or_pending
expect
(
builds_names
).
to
eq
%w[code:test staging:deploy staging:test
production:deploy production:test]
expect
(
builds_statuses
).
to
eq
%w[success success success success success]
expect
(
pipeline
.
reload
).
to
be_success
end
end
end
end
context
'when second stage has only on_failure jobs'
do
context
'when second stage has only on_failure jobs'
do
...
@@ -463,6 +518,10 @@ describe Ci::ProcessPipelineService, '#execute', :services do
...
@@ -463,6 +518,10 @@ describe Ci::ProcessPipelineService, '#execute', :services do
pipeline
.
builds
.
running_or_pending
.
each
(
&
:cancel
)
pipeline
.
builds
.
running_or_pending
.
each
(
&
:cancel
)
end
end
def
play_manual_action
(
name
)
builds
.
find_by
(
name:
name
).
play
(
user
)
end
delegate
:manual_actions
,
to: :pipeline
delegate
:manual_actions
,
to: :pipeline
def
create_build
(
name
,
**
opts
)
def
create_build
(
name
,
**
opts
)
...
...
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