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
e8c48734
Commit
e8c48734
authored
Feb 01, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EE specific spec for job_artifact_uploader and jobs_controller
parent
b0eebb17
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
5 deletions
+67
-5
app/uploaders/job_artifact_uploader.rb
app/uploaders/job_artifact_uploader.rb
+4
-5
ee/app/uploaders/ee/job_artifact_uploader.rb
ee/app/uploaders/ee/job_artifact_uploader.rb
+13
-0
spec/ee/spec/controllers/ee/projects/jobs_controller_spec.rb
spec/ee/spec/controllers/ee/projects/jobs_controller_spec.rb
+28
-0
spec/ee/spec/uploaders/ee/job_artifact_uploader_spec.rb
spec/ee/spec/uploaders/ee/job_artifact_uploader_spec.rb
+22
-0
No files found.
app/uploaders/job_artifact_uploader.rb
View file @
e8c48734
class
JobArtifactUploader
<
GitlabUploader
prepend
EE
::
JobArtifactUploader
extend
Workhorse
::
UploadPath
include
ObjectStorage
::
Concern
...
...
@@ -15,11 +16,9 @@ class JobArtifactUploader < GitlabUploader
end
def
open
if
file_storage?
raise
'Only File System is supported'
unless
file_storage?
File
.
open
(
path
,
"rb"
)
if
path
else
Gitlab
::
Ci
::
Trace
::
HttpIO
.
new
(
url
,
size
)
end
end
def
filename
...
...
ee/app/uploaders/ee/job_artifact_uploader.rb
0 → 100644
View file @
e8c48734
module
EE
module
JobArtifactUploader
extend
ActiveSupport
::
Concern
def
open
if
file_storage?
super
else
::
Gitlab
::
Ci
::
Trace
::
HttpIO
.
new
(
url
,
size
)
if
url
end
end
end
end
spec/ee/spec/controllers/ee/projects/jobs_controller_spec.rb
0 → 100644
View file @
e8c48734
require
'spec_helper'
describe
Projects
::
JobsController
do
include
ApiHelpers
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
describe
'GET raw'
do
subject
do
post
:raw
,
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
job
.
id
end
context
'when the trace artifact is in ObjectStorage'
do
let!
(
:job
)
{
create
(
:ci_build
,
:trace_artifact
,
pipeline:
pipeline
)
}
before
do
allow_any_instance_of
(
JobArtifactUploader
).
to
receive
(
:file_storage?
)
{
false
}
end
it
'redirect to the trace file url'
do
expect
(
subject
).
to
redirect_to
(
job
.
job_artifacts_trace
.
file
.
url
)
end
end
end
end
spec/ee/spec/uploaders/ee/job_artifact_uploader_spec.rb
0 → 100644
View file @
e8c48734
require
'spec_helper'
describe
JobArtifactUploader
do
let
(
:store
)
{
described_class
::
LOCAL_STORE
}
let
(
:job_artifact
)
{
create
(
:ci_job_artifact
,
file_store:
store
)
}
let
(
:uploader
)
{
described_class
.
new
(
job_artifact
,
:file
)
}
describe
'#open'
do
subject
{
uploader
.
open
}
context
'when trace is stored in Object storage'
do
before
do
allow
(
uploader
).
to
receive
(
:file_storage?
)
{
false
}
allow
(
uploader
).
to
receive
(
:url
)
{
'http://object_storage.com/trace'
}
end
it
'returns http io stream'
do
is_expected
.
to
be_a
(
Gitlab
::
Ci
::
Trace
::
HttpIO
)
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