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
7d6538f2
Commit
7d6538f2
authored
Jul 26, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename method responsible for updating stage status
parent
f4e01b59
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
6 deletions
+8
-6
stage.rb
app/models/ci/stage.rb
+1
-1
stage_update_worker.rb
app/workers/stage_update_worker.rb
+3
-1
stage_spec.rb
spec/models/ci/stage_spec.rb
+4
-4
No files found.
app/models/ci/stage.rb
View file @
7d6538f2
...
...
@@ -50,7 +50,7 @@ module Ci
end
end
def
update
!
def
update
_status
retry_optimistic_lock
(
self
)
do
case
commit_statuses
.
latest
.
status
when
'pending'
then
enqueue
...
...
app/workers/stage_update_worker.rb
View file @
7d6538f2
...
...
@@ -3,6 +3,8 @@ class StageUpdateWorker
include
PipelineQueue
def
perform
(
stage_id
)
Ci
::
Stage
.
find_by
(
id:
stage_id
)
&
.
update!
Ci
::
Stage
.
find_by
(
id:
stage_id
).
try
do
|
stage
|
stage
.
update_status
end
end
end
spec/models/ci/stage_spec.rb
View file @
7d6538f2
...
...
@@ -40,7 +40,7 @@ describe Ci::Stage, :models do
end
end
describe
'update
!
'
do
describe
'update
_status
'
do
context
'when stage objects needs to be updated'
do
before
do
create
(
:ci_build
,
:success
,
stage_id:
stage
.
id
)
...
...
@@ -48,7 +48,7 @@ describe Ci::Stage, :models do
end
it
'updates stage status correctly'
do
expect
{
stage
.
update
!
}
expect
{
stage
.
update
_status
}
.
to
change
{
stage
.
reload
.
status
}
.
to
'running'
end
...
...
@@ -56,7 +56,7 @@ describe Ci::Stage, :models do
context
'when stage is skipped'
do
it
'updates status to skipped'
do
expect
{
stage
.
update
!
}
expect
{
stage
.
update
_status
}
.
to
change
{
stage
.
reload
.
status
}
.
to
'skipped'
end
...
...
@@ -70,7 +70,7 @@ describe Ci::Stage, :models do
it
'retries a lock to update a stage status'
do
stage
.
lock_version
=
100
stage
.
update
!
stage
.
update
_status
expect
(
stage
.
reload
).
to
be_failed
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