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
Jérome Perrin
gitlab-ce
Commits
aa812dbf
Commit
aa812dbf
authored
Feb 19, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix missing ignored? for GenericCommitStatus
parent
1817b766
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
29 deletions
+33
-29
app/models/ci/build.rb
app/models/ci/build.rb
+0
-4
app/models/commit_status.rb
app/models/commit_status.rb
+4
-0
spec/lib/ci/status_spec.rb
spec/lib/ci/status_spec.rb
+29
-25
No files found.
app/models/ci/build.rb
View file @
aa812dbf
...
@@ -116,10 +116,6 @@ module Ci
...
@@ -116,10 +116,6 @@ module Ci
end
end
end
end
def
ignored?
failed?
&&
allow_failure?
end
def
retryable?
def
retryable?
project
.
builds_enabled?
&&
commands
.
present?
project
.
builds_enabled?
&&
commands
.
present?
end
end
...
...
app/models/commit_status.rb
View file @
aa812dbf
...
@@ -113,6 +113,10 @@ class CommitStatus < ActiveRecord::Base
...
@@ -113,6 +113,10 @@ class CommitStatus < ActiveRecord::Base
canceled?
||
success?
||
failed?
canceled?
||
success?
||
failed?
end
end
def
ignored?
failed?
&&
allow_failure?
end
def
duration
def
duration
if
started_at
&&
finished_at
if
started_at
&&
finished_at
finished_at
-
started_at
finished_at
-
started_at
...
...
spec/lib/ci/status_spec.rb
View file @
aa812dbf
...
@@ -2,36 +2,40 @@ require 'spec_helper'
...
@@ -2,36 +2,40 @@ require 'spec_helper'
describe
Ci
::
Status
do
describe
Ci
::
Status
do
describe
'.get_status'
do
describe
'.get_status'
do
subject
{
described_class
.
get_status
(
builds
)
}
subject
{
described_class
.
get_status
(
statuses
)
}
[
:ci_build
,
:generic_commit_status
].
each
do
|
type
|
context
"for
#{
type
}
"
do
context
'all successful'
do
let
(
:statuses
)
{
Array
.
new
(
2
)
{
create
(
type
,
status: :success
)
}
}
it
{
is_expected
.
to
eq
'success'
}
end
context
'all builds successful'
do
context
'at least one failed'
do
let
(
:builds
)
{
Array
.
new
(
2
)
{
create
(
:ci_build
,
:success
)
}
}
let
(
:statuses
)
{
[
create
(
type
,
status: :success
),
create
(
type
,
status: :failed
)]
}
it
{
is_expected
.
to
eq
'success'
}
it
{
is_expected
.
to
eq
'failed'
}
end
end
context
'at least one build failed'
do
let
(
:builds
)
{
[
create
(
:ci_build
,
:success
),
create
(
:ci_build
,
:failed
)]
}
it
{
is_expected
.
to
eq
'failed'
}
end
context
'at least one running'
do
context
'at least one running'
do
let
(
:builds
)
{
[
create
(
:ci_build
,
:success
),
create
(
:ci_build
,
:running
)]
}
let
(
:statuses
)
{
[
create
(
type
,
status: :success
),
create
(
type
,
status:
:running
)]
}
it
{
is_expected
.
to
eq
'running'
}
it
{
is_expected
.
to
eq
'running'
}
end
end
context
'at least one pending'
do
context
'at least one pending'
do
let
(
:builds
)
{
[
create
(
:ci_build
,
:success
),
create
(
:ci_build
,
:pending
)]
}
let
(
:statuses
)
{
[
create
(
type
,
status: :success
),
create
(
type
,
status:
:pending
)]
}
it
{
is_expected
.
to
eq
'running'
}
it
{
is_expected
.
to
eq
'running'
}
end
end
context
'build
success and failed but allowed to fail'
do
context
'
success and failed but allowed to fail'
do
let
(
:builds
)
{
[
create
(
:ci_build
,
:success
),
create
(
:ci_build
,
:failed
,
:allowed_to_fail
)]
}
let
(
:statuses
)
{
[
create
(
type
,
status: :success
),
create
(
type
,
status: :failed
,
allow_failure:
true
)]
}
it
{
is_expected
.
to
eq
'success'
}
it
{
is_expected
.
to
eq
'success'
}
end
end
context
'one build failed but allowed to fail'
do
context
'one failed but allowed to fail'
do
let
(
:builds
)
{
[
create
(
:ci_build
,
:failed
,
:allowed_to_fail
)]
}
let
(
:statuses
)
{
[
create
(
type
,
status: :failed
,
allow_failure:
true
)]
}
it
{
is_expected
.
to
eq
'success'
}
it
{
is_expected
.
to
eq
'success'
}
end
end
end
end
end
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