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
2cd68ab8
Commit
2cd68ab8
authored
Jun 14, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix CI specs
parent
a322a5e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
1 deletion
+49
-1
app/uploaders/object_store_uploader.rb
app/uploaders/object_store_uploader.rb
+13
-1
spec/uploaders/object_store_uploader_spec.rb
spec/uploaders/object_store_uploader_spec.rb
+36
-0
No files found.
app/uploaders/object_store_uploader.rb
View file @
2cd68ab8
require
'fog/aws'
require
'fog/aws'
require
'carrierwave/storage/fog'
require
'carrierwave/storage/fog'
class
ObjectStoreUploader
<
GitlabUploader
class
ObjectStoreUploader
<
CarrierWave
::
Uploader
::
Base
before
:store
,
:set_default_local_store
before
:store
,
:set_default_local_store
before
:store
,
:verify_license!
before
:store
,
:verify_license!
...
@@ -29,6 +29,14 @@ class ObjectStoreUploader < GitlabUploader
...
@@ -29,6 +29,14 @@ class ObjectStoreUploader < GitlabUploader
@field
=
field
@field
=
field
end
end
def
file_storage?
storage
.
is_a?
(
CarrierWave
::
Storage
::
File
)
end
def
file_cache_storage?
cache_storage
.
is_a?
(
CarrierWave
::
Storage
::
File
)
end
def
object_store
def
object_store
subject
.
public_send
(
:"
#{
field
}
_store"
)
subject
.
public_send
(
:"
#{
field
}
_store"
)
end
end
...
@@ -112,6 +120,10 @@ class ObjectStoreUploader < GitlabUploader
...
@@ -112,6 +120,10 @@ class ObjectStoreUploader < GitlabUploader
raise
'Object Storage feature is missing'
unless
subject
.
project
.
feature_available?
(
:object_storage
)
raise
'Object Storage feature is missing'
unless
subject
.
project
.
feature_available?
(
:object_storage
)
end
end
def
exists?
file
.
try
(
:exists?
)
end
private
private
def
set_default_local_store
(
new_file
)
def
set_default_local_store
(
new_file
)
...
...
spec/uploaders/object_store_uploader_spec.rb
View file @
2cd68ab8
...
@@ -22,6 +22,42 @@ describe ObjectStoreUploader do
...
@@ -22,6 +22,42 @@ describe ObjectStoreUploader do
end
end
end
end
describe
'#file_storage?'
do
context
'when file storage is used'
do
before
do
uploader_class
.
storage
(
:file
)
end
it
{
is_expected
.
to
be_file_storage
}
end
context
'when is remote storage'
do
before
do
uploader_class
.
storage
(
:fog
)
end
it
{
is_expected
.
not_to
be_file_storage
}
end
end
describe
'#file_cache_storage?'
do
context
'when file storage is used'
do
before
do
uploader_class
.
cache_storage
(
:file
)
end
it
{
is_expected
.
to
be_file_cache_storage
}
end
context
'when is remote storage'
do
before
do
uploader_class
.
cache_storage
(
:fog
)
end
it
{
is_expected
.
not_to
be_file_cache_storage
}
end
end
context
'when using ArtifactsUploader'
do
context
'when using ArtifactsUploader'
do
let
(
:job
)
{
create
(
:ci_build
,
:artifacts
,
artifacts_file_store:
store
)
}
let
(
:job
)
{
create
(
:ci_build
,
:artifacts
,
artifacts_file_store:
store
)
}
let
(
:uploader
)
{
job
.
artifacts_file
}
let
(
:uploader
)
{
job
.
artifacts_file
}
...
...
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