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
ac50f9dd
Commit
ac50f9dd
authored
Apr 12, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix rest of rspec and spinach tests
parent
52be9e20
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
15 deletions
+26
-15
app/models/ci/commit.rb
app/models/ci/commit.rb
+5
-5
app/models/concerns/ci_status.rb
app/models/concerns/ci_status.rb
+4
-2
app/services/ci/create_builds_service.rb
app/services/ci/create_builds_service.rb
+1
-1
features/steps/shared/builds.rb
features/steps/shared/builds.rb
+3
-3
features/steps/shared/project.rb
features/steps/shared/project.rb
+1
-1
spec/lib/ci/status_spec.rb
spec/lib/ci/status_spec.rb
+12
-3
No files found.
app/models/ci/commit.rb
View file @
ac50f9dd
...
@@ -117,7 +117,7 @@ module Ci
...
@@ -117,7 +117,7 @@ module Ci
# get status for all prior builds
# get status for all prior builds
prior_builds
=
latest_builds
.
reject
{
|
other_build
|
next_stages
.
include?
(
other_build
.
stage
)
}
prior_builds
=
latest_builds
.
reject
{
|
other_build
|
next_stages
.
include?
(
other_build
.
stage
)
}
status
=
Ci
::
Status
.
get_status
(
prior_builds
)
status
=
prior_builds
.
status
# create builds for next stages based
# create builds for next stages based
next_stages
.
any?
do
|
stage
|
next_stages
.
any?
do
|
stage
|
...
@@ -185,7 +185,7 @@ module Ci
...
@@ -185,7 +185,7 @@ module Ci
private
private
def
update_status
def
update_status
status
=
s
elf
.
s
tatus
=
if
yaml_errors
.
present?
if
yaml_errors
.
present?
'failed'
'failed'
else
else
...
@@ -194,17 +194,17 @@ module Ci
...
@@ -194,17 +194,17 @@ module Ci
end
end
def
update_started_at
def
update_started_at
started_at
=
s
elf
.
s
tarted_at
=
statuses
.
minimum
(
:started_at
)
statuses
.
minimum
(
:started_at
)
end
end
def
update_finished_at
def
update_finished_at
finished_at
=
self
.
finished_at
=
statuses
.
maximum
(
:finished_at
)
statuses
.
maximum
(
:finished_at
)
end
end
def
update_duration
def
update_duration
duration
=
begin
self
.
duration
=
begin
duration_array
=
latest
.
map
(
&
:duration
).
compact
duration_array
=
latest
.
map
(
&
:duration
).
compact
duration_array
.
reduce
(:
+
).
to_i
duration_array
.
reduce
(:
+
).
to_i
end
end
...
...
app/models/concerns/ci_status.rb
View file @
ac50f9dd
...
@@ -14,6 +14,8 @@ module CiStatus
...
@@ -14,6 +14,8 @@ module CiStatus
'running'
'running'
elsif
objs
.
all?
(
&
:canceled?
)
elsif
objs
.
all?
(
&
:canceled?
)
'canceled'
'canceled'
elsif
objs
.
all?
(
&
:skipped?
)
'skipped'
else
else
'failed'
'failed'
end
end
...
...
app/services/ci/create_builds_service.rb
View file @
ac50f9dd
features/steps/shared/builds.rb
View file @
ac50f9dd
...
@@ -10,16 +10,16 @@ module SharedBuilds
...
@@ -10,16 +10,16 @@ module SharedBuilds
end
end
step
'project has a recent build'
do
step
'project has a recent build'
do
@ci_commit
=
create
(
:ci_commit
,
project:
@project
,
sha:
@project
.
commit
.
sha
)
@ci_commit
=
create
(
:ci_commit
,
project:
@project
,
sha:
@project
.
commit
.
sha
,
ref:
'master'
)
@build
=
create
(
:ci_build_with_coverage
,
commit:
@ci_commit
)
@build
=
create
(
:ci_build_with_coverage
,
commit:
@ci_commit
)
end
end
step
'recent build is successful'
do
step
'recent build is successful'
do
@build
.
update
_column
(
:status
,
'success'
)
@build
.
update
(
status:
'success'
)
end
end
step
'recent build failed'
do
step
'recent build failed'
do
@build
.
update
_column
(
:status
,
'failed'
)
@build
.
update
(
status:
'failed'
)
end
end
step
'project has another build that is running'
do
step
'project has another build that is running'
do
...
...
features/steps/shared/project.rb
View file @
ac50f9dd
...
@@ -230,7 +230,7 @@ module SharedProject
...
@@ -230,7 +230,7 @@ module SharedProject
step
'project "Shop" has CI build'
do
step
'project "Shop" has CI build'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
project
=
Project
.
find_by
(
name:
"Shop"
)
c
reate
:ci_commit
,
project:
project
,
sha:
project
.
commit
.
sha
,
ref:
'master
'
c
ommit
=
create
:ci_commit
,
project:
project
,
sha:
project
.
commit
.
sha
,
ref:
'master'
,
status:
'skipped
'
end
end
step
'I should see last commit with CI status'
do
step
'I should see last commit with CI status'
do
...
...
spec/lib/ci/status_spec.rb
View file @
ac50f9dd
require
'spec_helper'
require
'spec_helper'
describe
Ci
::
Status
do
describe
CiStatus
do
describe
'.get_status'
do
before
do
subject
{
described_class
.
get_status
(
statuses
)
}
@object
=
Object
.
new
@object
.
extend
(
CiStatus
::
ClassMethods
)
end
describe
'.status'
do
before
do
allow
(
@object
).
to
receive
(
:all
).
and_return
(
statuses
)
end
subject
{
@object
.
status
}
shared_examples
'build status summary'
do
shared_examples
'build status summary'
do
context
'all successful'
do
context
'all successful'
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