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
301c4ef9
Commit
301c4ef9
authored
Mar 19, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use update_column than write_attribute and save
parent
6cfea81e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
build.rb
app/models/ci/build.rb
+1
-2
trace_spec.rb
spec/lib/gitlab/ci/trace_spec.rb
+22
-0
No files found.
app/models/ci/build.rb
View file @
301c4ef9
...
@@ -328,8 +328,7 @@ module Ci
...
@@ -328,8 +328,7 @@ module Ci
end
end
def
erase_old_trace!
def
erase_old_trace!
write_attribute
(
:trace
,
nil
)
update_column
(
:trace
,
nil
)
save
end
end
def
needs_touch?
def
needs_touch?
...
...
spec/lib/gitlab/ci/trace_spec.rb
View file @
301c4ef9
...
@@ -510,6 +510,28 @@ describe Gitlab::Ci::Trace do
...
@@ -510,6 +510,28 @@ describe Gitlab::Ci::Trace do
it_behaves_like
'source trace in database stays intact'
,
error:
ActiveRecord
::
RecordInvalid
it_behaves_like
'source trace in database stays intact'
,
error:
ActiveRecord
::
RecordInvalid
end
end
context
'when there is a validation error on Ci::Build'
do
before
do
allow_any_instance_of
(
Ci
::
Build
).
to
receive
(
:save
).
and_return
(
false
)
allow_any_instance_of
(
Ci
::
Build
).
to
receive_message_chain
(
:errors
,
:full_messages
)
.
and_return
(
%w[Error Error]
)
end
context
"when erase old trace with 'save'"
do
before
do
build
.
send
(
:write_attribute
,
:trace
,
nil
)
build
.
save
end
it
'old trace is not deleted'
do
build
.
reload
expect
(
build
.
trace
.
raw
).
to
eq
(
trace_content
)
end
end
it_behaves_like
'archive trace in database'
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