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
b2608d2a
Commit
b2608d2a
authored
Sep 10, 2019
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename uploader mentions to retriever
parent
c20672b4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
20 deletions
+20
-20
ee/app/services/geo/file_upload_service.rb
ee/app/services/geo/file_upload_service.rb
+4
-4
ee/spec/lib/gitlab/geo/replication/file_retriever_spec.rb
ee/spec/lib/gitlab/geo/replication/file_retriever_spec.rb
+2
-2
ee/spec/lib/gitlab/geo/replication/job_artifact_retriever_spec.rb
...lib/gitlab/geo/replication/job_artifact_retriever_spec.rb
+3
-3
ee/spec/lib/gitlab/geo/replication/lfs_retriever_spec.rb
ee/spec/lib/gitlab/geo/replication/lfs_retriever_spec.rb
+4
-4
ee/spec/services/geo/file_upload_service_spec.rb
ee/spec/services/geo/file_upload_service_spec.rb
+7
-7
No files found.
ee/app/services/geo/file_upload_service.rb
View file @
b2608d2a
...
...
@@ -17,11 +17,11 @@ module Geo
def
execute
return
unless
decoded_authorization
.
present?
&&
jwt_scope_valid?
upload
er
.
execute
retriev
er
.
execute
end
def
upload
er
upload
er_klass
.
new
(
object_db_id
,
decoded_authorization
)
def
retriev
er
retriev
er_klass
.
new
(
object_db_id
,
decoded_authorization
)
end
private
...
...
@@ -36,7 +36,7 @@ module Geo
end
end
def
upload
er_klass
def
retriev
er_klass
return
Gitlab
::
Geo
::
Replication
::
FileRetriever
if
user_upload?
return
Gitlab
::
Geo
::
Replication
::
JobArtifactRetriever
if
job_artifact?
return
Gitlab
::
Geo
::
Replication
::
LfsRetriever
if
lfs?
...
...
ee/spec/lib/gitlab/geo/replication/file_retriever_spec.rb
View file @
b2608d2a
...
...
@@ -2,10 +2,10 @@ require 'spec_helper'
describe
Gitlab
::
Geo
::
Replication
::
FileRetriever
,
:geo
do
shared_examples_for
'returns necessary params for sending a file from an API endpoint'
do
subject
{
@subject
||=
upload
er
.
execute
}
subject
{
@subject
||=
retriev
er
.
execute
}
context
'when the upload exists'
do
let
(
:
upload
er
)
{
described_class
.
new
(
upload
.
id
,
message
)
}
let
(
:
retriev
er
)
{
described_class
.
new
(
upload
.
id
,
message
)
}
before
do
expect
(
Upload
).
to
receive
(
:find_by
).
with
(
id:
upload
.
id
).
and_return
(
upload
)
...
...
ee/spec/lib/gitlab/geo/replication/job_artifact_retriever_spec.rb
View file @
b2608d2a
...
...
@@ -2,8 +2,8 @@ require 'spec_helper'
describe
Gitlab
::
Geo
::
Replication
::
JobArtifactRetriever
,
:geo
do
context
'#execute'
do
let
(
:
upload
er
)
{
described_class
.
new
(
job_artifact
.
id
,
{})
}
subject
{
upload
er
.
execute
}
let
(
:
retriev
er
)
{
described_class
.
new
(
job_artifact
.
id
,
{})
}
subject
{
retriev
er
.
execute
}
context
'when the job artifact exists'
do
before
do
...
...
@@ -34,7 +34,7 @@ describe Gitlab::Geo::Replication::JobArtifactRetriever, :geo do
end
it
'logs the missing file'
do
expect
(
upload
er
).
to
receive
(
:log_error
).
with
(
"Could not upload job artifact because it does not have a file"
,
id:
job_artifact
.
id
)
expect
(
retriev
er
).
to
receive
(
:log_error
).
with
(
"Could not upload job artifact because it does not have a file"
,
id:
job_artifact
.
id
)
subject
end
...
...
ee/spec/lib/gitlab/geo/replication/lfs_retriever_spec.rb
View file @
b2608d2a
...
...
@@ -2,10 +2,10 @@ require 'spec_helper'
describe
Gitlab
::
Geo
::
Replication
::
LfsRetriever
,
:geo
do
context
'#execute'
do
subject
{
upload
er
.
execute
}
subject
{
retriev
er
.
execute
}
context
'when the LFS object exists'
do
let
(
:
upload
er
)
{
described_class
.
new
(
lfs_object
.
id
,
message
)
}
let
(
:
retriev
er
)
{
described_class
.
new
(
lfs_object
.
id
,
message
)
}
before
do
expect
(
LfsObject
).
to
receive
(
:find_by
).
with
(
id:
lfs_object
.
id
).
and_return
(
lfs_object
)
...
...
@@ -39,7 +39,7 @@ describe Gitlab::Geo::Replication::LfsRetriever, :geo do
end
it
'logs the missing file'
do
expect
(
upload
er
).
to
receive
(
:log_error
).
with
(
"Could not upload LFS object because it does not have a file"
,
id:
lfs_object
.
id
)
expect
(
retriev
er
).
to
receive
(
:log_error
).
with
(
"Could not upload LFS object because it does not have a file"
,
id:
lfs_object
.
id
)
subject
end
...
...
@@ -47,7 +47,7 @@ describe Gitlab::Geo::Replication::LfsRetriever, :geo do
end
context
'when the LFS object does not exist'
do
let
(
:
upload
er
)
{
described_class
.
new
(
10000
,
{})
}
let
(
:
retriev
er
)
{
described_class
.
new
(
10000
,
{})
}
it
'returns an error hash'
do
expect
(
subject
).
to
eq
(
code: :not_found
,
message:
'LFS object not found'
)
...
...
ee/spec/services/geo/file_upload_service_spec.rb
View file @
b2608d2a
...
...
@@ -12,25 +12,25 @@ describe Geo::FileUploadService do
stub_current_geo_node
(
node
)
end
describe
'#
upload
er'
do
describe
'#
retriev
er'
do
Gitlab
::
Geo
::
Replication
::
USER_UPLOADS_OBJECT_TYPES
.
each
do
|
file_type
|
it
"returns a File
Upload
er given type is
#{
file_type
}
"
do
it
"returns a File
Retriev
er given type is
#{
file_type
}
"
do
subject
=
described_class
.
new
({
type:
file_type
,
id:
1
},
'request-data'
)
expect
(
subject
.
upload
er
).
to
be_a
(
Gitlab
::
Geo
::
Replication
::
FileRetriever
)
expect
(
subject
.
retriev
er
).
to
be_a
(
Gitlab
::
Geo
::
Replication
::
FileRetriever
)
end
end
it
"returns a Lfs
Upload
er given object_type is lfs"
do
it
"returns a Lfs
Retriev
er given object_type is lfs"
do
subject
=
described_class
.
new
({
type:
'lfs'
,
id:
1
},
'request-data'
)
expect
(
subject
.
upload
er
).
to
be_a
(
Gitlab
::
Geo
::
Replication
::
LfsRetriever
)
expect
(
subject
.
retriev
er
).
to
be_a
(
Gitlab
::
Geo
::
Replication
::
LfsRetriever
)
end
it
"returns a JobArtifact
Upload
er given object_type is job_artifact"
do
it
"returns a JobArtifact
Retriev
er given object_type is job_artifact"
do
subject
=
described_class
.
new
({
type:
'job_artifact'
,
id:
1
},
'request-data'
)
expect
(
subject
.
upload
er
).
to
be_a
(
Gitlab
::
Geo
::
Replication
::
JobArtifactRetriever
)
expect
(
subject
.
retriev
er
).
to
be_a
(
Gitlab
::
Geo
::
Replication
::
JobArtifactRetriever
)
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