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
Léo-Paul Géneau
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
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
app/models/ci/build.rb
app/models/ci/build.rb
+1
-2
spec/lib/gitlab/ci/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