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
737666a3
Commit
737666a3
authored
Jul 09, 2018
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs
parent
5a9f23e7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
13 deletions
+13
-13
app/uploaders/gitlab_uploader.rb
app/uploaders/gitlab_uploader.rb
+6
-5
spec/controllers/projects/jobs_controller_spec.rb
spec/controllers/projects/jobs_controller_spec.rb
+5
-6
spec/requests/api/jobs_spec.rb
spec/requests/api/jobs_spec.rb
+2
-2
No files found.
app/uploaders/gitlab_uploader.rb
View file @
737666a3
...
...
@@ -76,11 +76,12 @@ class GitlabUploader < CarrierWave::Uploader::Base
end
def
open
stream
=
if
file_storage?
File
.
open
(
path
,
"rb"
)
if
path
else
::
Gitlab
::
HttpIO
.
new
(
url
,
cached_size
)
if
url
end
stream
=
if
file_storage?
File
.
open
(
path
,
"rb"
)
if
path
else
::
Gitlab
::
HttpIO
.
new
(
url
,
cached_size
)
if
url
end
return
unless
stream
return
stream
unless
block_given?
...
...
spec/controllers/projects/jobs_controller_spec.rb
View file @
737666a3
...
...
@@ -216,20 +216,19 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end
context
'when trace artifact is in ObjectStorage'
do
let
(
:url
)
{
'http://object-storage/trace'
}
let
(
:file_path
)
{
expand_fixture_path
(
'trace/sample_trace'
)
}
let!
(
:job
)
{
create
(
:ci_build
,
:success
,
:trace_artifact
,
pipeline:
pipeline
)
}
before
do
allow_any_instance_of
(
JobArtifactUploader
).
to
receive
(
:file_storage?
)
{
false
}
allow_any_instance_of
(
JobArtifactUploader
).
to
receive
(
:url
)
{
remote_trace_
url
}
allow_any_instance_of
(
JobArtifactUploader
).
to
receive
(
:size
)
{
remote_trace_size
}
allow_any_instance_of
(
JobArtifactUploader
).
to
receive
(
:url
)
{
url
}
allow_any_instance_of
(
JobArtifactUploader
).
to
receive
(
:size
)
{
File
.
size
(
file_path
)
}
end
context
'when there are no network issues'
do
let
(
:url
)
{
'http://object-storage/trace'
}
let
(
:file
)
{
expand_fixture_path
(
'trace/sample_trace'
)
}
before
do
stub_remote_url_206
(
url
,
file
)
stub_remote_url_206
(
url
,
file
_path
)
get_trace
end
...
...
spec/requests/api/jobs_spec.rb
View file @
737666a3
...
...
@@ -536,13 +536,13 @@ describe API::Jobs do
context
'when trace is in ObjectStorage'
do
let!
(
:job
)
{
create
(
:ci_build
,
:trace_artifact
,
pipeline:
pipeline
)
}
let
(
:url
)
{
'http://object-storage/trace'
}
let
(
:file
)
{
expand_fixture_path
(
'trace/sample_trace'
)
}
let
(
:file
_path
)
{
expand_fixture_path
(
'trace/sample_trace'
)
}
before
do
stub_remote_url_206
(
url
,
file_path
)
allow_any_instance_of
(
JobArtifactUploader
).
to
receive
(
:file_storage?
)
{
false
}
allow_any_instance_of
(
JobArtifactUploader
).
to
receive
(
:url
)
{
url
}
allow_any_instance_of
(
JobArtifactUploader
).
to
receive
(
:size
)
{
File
.
size
(
file
)
}
allow_any_instance_of
(
JobArtifactUploader
).
to
receive
(
:size
)
{
File
.
size
(
file
_path
)
}
end
it
'returns specific job trace'
do
...
...
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