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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
3a5cb44f
Commit
3a5cb44f
authored
Mar 01, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix static analysys
parent
583b49f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
lib/gitlab/ci/trace.rb
lib/gitlab/ci/trace.rb
+1
-0
spec/lib/gitlab/ci/trace_spec.rb
spec/lib/gitlab/ci/trace_spec.rb
+7
-7
No files found.
lib/gitlab/ci/trace.rb
View file @
3a5cb44f
...
...
@@ -125,6 +125,7 @@ module Gitlab
FileUtils
.
touch
(
temp_path
)
size
=
IO
.
copy_stream
(
src_stream
,
temp_path
)
raise
'Not all saved'
unless
size
==
src_stream
.
size
yield
(
temp_path
)
end
end
...
...
spec/lib/gitlab/ci/trace_spec.rb
View file @
3a5cb44f
...
...
@@ -439,7 +439,7 @@ describe Gitlab::Ci::Trace do
expect
(
build
.
old_trace
).
to
be_nil
expect
(
src_checksum
)
.
to
eq
(
Digest
::
SHA256
.
file
(
build
.
job_artifacts_trace
.
file
.
path
).
digest
)
end
end
end
shared_examples
'source trace in database stays intact'
do
|
error
:|
...
...
@@ -463,7 +463,7 @@ describe Gitlab::Ci::Trace do
context
'when failed to create clone file'
do
before
do
allow_any_instance_of
(
Gitlab
::
Ci
::
Trace
)
allow_any_instance_of
(
described_class
)
.
to
receive
(
:clone_file!
).
and_raise
(
'Not all saved'
)
end
...
...
@@ -474,7 +474,7 @@ describe Gitlab::Ci::Trace do
before
do
allow_any_instance_of
(
Ci
::
JobArtifact
).
to
receive
(
:save
).
and_return
(
false
)
allow_any_instance_of
(
Ci
::
JobArtifact
).
to
receive_message_chain
(
:errors
,
:full_messages
)
.
and_return
(
[
"Error"
,
'Error'
])
.
and_return
(
%w[Error Error
]
)
end
it_behaves_like
'source trace file stays intact'
,
error:
ActiveRecord
::
RecordInvalid
...
...
@@ -494,7 +494,7 @@ describe Gitlab::Ci::Trace do
context
'when failed to create clone file'
do
before
do
allow_any_instance_of
(
Gitlab
::
Ci
::
Trace
)
allow_any_instance_of
(
described_class
)
.
to
receive
(
:clone_file!
).
and_raise
(
'Not all saved'
)
end
...
...
@@ -505,7 +505,7 @@ describe Gitlab::Ci::Trace do
before
do
allow_any_instance_of
(
Ci
::
JobArtifact
).
to
receive
(
:save
).
and_return
(
false
)
allow_any_instance_of
(
Ci
::
JobArtifact
).
to
receive_message_chain
(
:errors
,
:full_messages
)
.
and_return
(
[
"Error"
,
'Error'
])
.
and_return
(
%w[Error Error
]
)
end
it_behaves_like
'source trace in database stays intact'
,
error:
ActiveRecord
::
RecordInvalid
...
...
@@ -519,7 +519,7 @@ describe Gitlab::Ci::Trace do
end
it
'does not archive'
do
expect_any_instance_of
(
Gitlab
::
Ci
::
Trace
).
not_to
receive
(
:archive_stream!
)
expect_any_instance_of
(
described_class
).
not_to
receive
(
:archive_stream!
)
expect
{
subject
}.
to
raise_error
(
'Already archived'
)
expect
(
build
.
job_artifacts_trace
.
file
.
exists?
).
to
be_truthy
end
...
...
@@ -529,7 +529,7 @@ describe Gitlab::Ci::Trace do
let!
(
:build
)
{
create
(
:ci_build
,
:running
,
:trace_live
)
}
it
'does not archive'
do
expect_any_instance_of
(
Gitlab
::
Ci
::
Trace
).
not_to
receive
(
:archive_stream!
)
expect_any_instance_of
(
described_class
).
not_to
receive
(
:archive_stream!
)
expect
{
subject
}.
to
raise_error
(
'Job is not finished yet'
)
expect
(
build
.
trace
.
exist?
).
to
be_truthy
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