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
Boxiang Sun
gitlab-ce
Commits
12401758
Commit
12401758
authored
Mar 06, 2018
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BuildMetadata styling improvements
parent
d58d3098
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
13 deletions
+12
-13
app/models/ci/build_metadata.rb
app/models/ci/build_metadata.rb
+5
-5
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+7
-8
No files found.
app/models/ci/build_metadata.rb
View file @
12401758
...
@@ -19,13 +19,13 @@ module Ci
...
@@ -19,13 +19,13 @@ module Ci
}
}
def
save_timeout_state!
def
save_timeout_state!
project_timeout
=
build
.
project
&
.
build_timeout
return
unless
build
.
runner
.
present?
timeout
=
[
project_timeout
,
build
.
runner
&
.
maximum_timeout
].
compact
.
min
self
.
timeout
=
timeout
project_timeout
=
build
.
project
&
.
build_timeout
self
.
timeout_source
=
timeout
<
project_timeout
?
:runner_timeout_source
:
:project_timeout_source
timeout
=
[
project_timeout
,
build
.
runner
.
maximum_timeout
].
compact
.
min
timeout_source
=
timeout
<
project_timeout
?
:runner_timeout_source
:
:project_timeout_source
save!
update_attributes
(
timeout:
timeout
,
timeout_source:
timeout_source
)
end
end
end
end
end
end
spec/models/ci/build_spec.rb
View file @
12401758
...
@@ -1283,8 +1283,10 @@ describe Ci::Build do
...
@@ -1283,8 +1283,10 @@ describe Ci::Build do
build
.
run!
build
.
run!
end
end
context
'when runner is not assigned'
do
it
'returns project timeout configuration'
do
it
'returns project timeout configuration'
do
is_expected
.
to
eq
(
project2
.
build_timeout
)
is_expected
.
to
be_nil
end
end
end
context
'when runner sets timeout to bigger value'
do
context
'when runner sets timeout to bigger value'
do
...
@@ -2045,8 +2047,7 @@ describe Ci::Build do
...
@@ -2045,8 +2047,7 @@ describe Ci::Build do
let
(
:job
)
{
create
(
:ci_build
,
:pending
,
runner:
runner
)
}
let
(
:job
)
{
create
(
:ci_build
,
:pending
,
runner:
runner
)
}
before
do
before
do
job
.
project
.
build_timeout
=
1800
job
.
project
.
update_attribute
(
:build_timeout
,
1800
)
job
.
project
.
save!
end
end
shared_examples
'saves data on transition'
do
shared_examples
'saves data on transition'
do
...
@@ -2064,8 +2065,7 @@ describe Ci::Build do
...
@@ -2064,8 +2065,7 @@ describe Ci::Build do
let
(
:expected_timeout_source
)
{
'runner_timeout_source'
}
let
(
:expected_timeout_source
)
{
'runner_timeout_source'
}
before
do
before
do
runner
.
maximum_timeout
=
900
runner
.
update_attribute
(
:maximum_timeout
,
900
)
runner
.
save!
end
end
it_behaves_like
'saves data on transition'
it_behaves_like
'saves data on transition'
...
@@ -2076,8 +2076,7 @@ describe Ci::Build do
...
@@ -2076,8 +2076,7 @@ describe Ci::Build do
let
(
:expected_timeout_source
)
{
'project_timeout_source'
}
let
(
:expected_timeout_source
)
{
'project_timeout_source'
}
before
do
before
do
runner
.
maximum_timeout
=
3600
runner
.
update_attribute
(
:maximum_timeout
,
3600
)
runner
.
save!
end
end
it_behaves_like
'saves data on transition'
it_behaves_like
'saves data on transition'
...
...
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