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
1670a9fe
Commit
1670a9fe
authored
Feb 24, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed static analysys
parent
414a638b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
app/services/ci/create_trace_artifact_service.rb
app/services/ci/create_trace_artifact_service.rb
+1
-1
spec/services/ci/create_trace_artifact_service_spec.rb
spec/services/ci/create_trace_artifact_service_spec.rb
+5
-5
No files found.
app/services/ci/create_trace_artifact_service.rb
View file @
1670a9fe
...
@@ -4,7 +4,7 @@ module Ci
...
@@ -4,7 +4,7 @@ module Ci
return
if
job
.
job_artifacts_trace
return
if
job
.
job_artifacts_trace
job
.
trace
.
read
do
|
stream
|
job
.
trace
.
read
do
|
stream
|
return
unless
stream
.
file?
return
unless
stream
.
file?
# rubocop:disable Lint/NonLocalExitFromIterator
temp_file!
(
stream
.
path
,
JobArtifactUploader
.
workhorse_upload_path
)
do
|
temp_path
|
temp_file!
(
stream
.
path
,
JobArtifactUploader
.
workhorse_upload_path
)
do
|
temp_path
|
job
.
create_job_artifacts_trace!
(
job
.
create_job_artifacts_trace!
(
...
...
spec/services/ci/create_trace_artifact_service_spec.rb
View file @
1670a9fe
...
@@ -12,13 +12,13 @@ describe Ci::CreateTraceArtifactService do
...
@@ -12,13 +12,13 @@ describe Ci::CreateTraceArtifactService do
let
(
:new_path
)
{
job
.
job_artifacts_trace
.
file
.
path
}
let
(
:new_path
)
{
job
.
job_artifacts_trace
.
file
.
path
}
let
(
:new_checksum
)
{
Digest
::
SHA256
.
file
(
new_path
).
hexdigest
}
let
(
:new_checksum
)
{
Digest
::
SHA256
.
file
(
new_path
).
hexdigest
}
it
{
expect
(
File
.
exist
s
?
(
legacy_path
)).
to
be_truthy
}
it
{
expect
(
File
.
exist?
(
legacy_path
)).
to
be_truthy
}
it
'creates trace artifact'
do
it
'creates trace artifact'
do
expect
{
subject
}.
to
change
{
Ci
::
JobArtifact
.
count
}.
by
(
1
)
expect
{
subject
}.
to
change
{
Ci
::
JobArtifact
.
count
}.
by
(
1
)
expect
(
File
.
exist
s
?
(
legacy_path
)).
to
be_falsy
expect
(
File
.
exist?
(
legacy_path
)).
to
be_falsy
expect
(
File
.
exist
s
?
(
new_path
)).
to
be_truthy
expect
(
File
.
exist?
(
new_path
)).
to
be_truthy
expect
(
new_checksum
).
to
eq
(
legacy_checksum
)
expect
(
new_checksum
).
to
eq
(
legacy_checksum
)
expect
(
job
.
job_artifacts_trace
.
file
.
exists?
).
to
be_truthy
expect
(
job
.
job_artifacts_trace
.
file
.
exists?
).
to
be_truthy
expect
(
job
.
job_artifacts_trace
.
file
.
filename
).
to
eq
(
'job.log'
)
expect
(
job
.
job_artifacts_trace
.
file
.
filename
).
to
eq
(
'job.log'
)
...
@@ -37,7 +37,7 @@ describe Ci::CreateTraceArtifactService do
...
@@ -37,7 +37,7 @@ describe Ci::CreateTraceArtifactService do
end
end
it
'keeps legacy trace and removes trace artifact'
do
it
'keeps legacy trace and removes trace artifact'
do
expect
(
File
.
exist
s
?
(
legacy_path
)).
to
be_truthy
expect
(
File
.
exist?
(
legacy_path
)).
to
be_truthy
expect
(
job
.
job_artifacts_trace
).
to
be_nil
expect
(
job
.
job_artifacts_trace
).
to
be_nil
end
end
end
end
...
@@ -50,7 +50,7 @@ describe Ci::CreateTraceArtifactService do
...
@@ -50,7 +50,7 @@ describe Ci::CreateTraceArtifactService do
it
'raises an error'
do
it
'raises an error'
do
expect
{
subject
}.
to
raise_error
(
'Trace artifact not found'
)
expect
{
subject
}.
to
raise_error
(
'Trace artifact not found'
)
expect
(
File
.
exist
s
?
(
legacy_path
)).
to
be_truthy
expect
(
File
.
exist?
(
legacy_path
)).
to
be_truthy
end
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