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
002819ad
Commit
002819ad
authored
Aug 24, 2019
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename Transfer to BaseTransfer
parent
b7c83960
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
11 additions
and
9 deletions
+11
-9
ee/lib/gitlab/geo/replication/base_transfer.rb
ee/lib/gitlab/geo/replication/base_transfer.rb
+2
-2
ee/lib/gitlab/geo/replication/file_transfer.rb
ee/lib/gitlab/geo/replication/file_transfer.rb
+1
-1
ee/lib/gitlab/geo/replication/job_artifact_transfer.rb
ee/lib/gitlab/geo/replication/job_artifact_transfer.rb
+1
-1
ee/lib/gitlab/geo/replication/lfs_transfer.rb
ee/lib/gitlab/geo/replication/lfs_transfer.rb
+1
-1
ee/spec/lib/gitlab/geo/replication/file_transfer_spec.rb
ee/spec/lib/gitlab/geo/replication/file_transfer_spec.rb
+2
-0
ee/spec/lib/gitlab/geo/replication/job_artifact_downloader_spec.rb
...ib/gitlab/geo/replication/job_artifact_downloader_spec.rb
+1
-1
ee/spec/lib/gitlab/geo/replication/lfs_downloader_spec.rb
ee/spec/lib/gitlab/geo/replication/lfs_downloader_spec.rb
+1
-1
ee/spec/services/geo/file_download_service_spec.rb
ee/spec/services/geo/file_download_service_spec.rb
+1
-1
ee/spec/workers/geo/file_download_dispatch_worker_spec.rb
ee/spec/workers/geo/file_download_dispatch_worker_spec.rb
+1
-1
No files found.
ee/lib/gitlab/geo/replication/transfer.rb
→
ee/lib/gitlab/geo/replication/
base_
transfer.rb
View file @
002819ad
...
...
@@ -3,7 +3,7 @@
module
Gitlab
module
Geo
module
Replication
class
Transfer
class
Base
Transfer
include
LogHelpers
attr_reader
:file_type
,
:file_id
,
:filename
,
:expected_checksum
,
:request_data
...
...
@@ -127,7 +127,7 @@ module Gitlab
end
def
code_file_not_found?
(
geo_code
)
geo_code
==
Gitlab
::
Geo
::
FileUploader
::
FILE_NOT_FOUND_GEO_CODE
geo_code
==
Gitlab
::
Geo
::
Replication
::
FileUploader
::
FILE_NOT_FOUND_GEO_CODE
end
def
default_permissions
...
...
ee/lib/gitlab/geo/replication/file_transfer.rb
View file @
002819ad
...
...
@@ -7,7 +7,7 @@ module Gitlab
# * Requesting an Upload file from the primary
# * Saving it in the right place on successful download
# * Returning a detailed Result object
class
FileTransfer
<
Transfer
class
FileTransfer
<
Base
Transfer
def
initialize
(
file_type
,
upload
)
super
(
file_type
,
...
...
ee/lib/gitlab/geo/replication/job_artifact_transfer.rb
View file @
002819ad
...
...
@@ -7,7 +7,7 @@ module Gitlab
# * Requesting an ::Ci::JobArtifact file from the primary
# * Saving it in the right place on successful download
# * Returning a detailed Result object
class
JobArtifactTransfer
<
Transfer
class
JobArtifactTransfer
<
Base
Transfer
def
initialize
(
job_artifact
)
super
(
:job_artifact
,
...
...
ee/lib/gitlab/geo/replication/lfs_transfer.rb
View file @
002819ad
...
...
@@ -7,7 +7,7 @@ module Gitlab
# * Requesting an LfsObject file from the primary
# * Saving it in the right place on successful download
# * Returning a detailed Result object
class
LfsTransfer
<
Transfer
class
LfsTransfer
<
Base
Transfer
def
initialize
(
lfs_object
)
super
(
:lfs
,
...
...
ee/spec/lib/gitlab/geo/replication/file_transfer_spec.rb
View file @
002819ad
...
...
@@ -65,6 +65,7 @@ describe Gitlab::Geo::Replication::FileTransfer do
it
'returns a failed result indicating primary_missing_file'
do
expect
(
FileUtils
).
not_to
receive
(
:mv
).
with
(
anything
,
upload
.
absolute_path
).
and_call_original
response
=
double
(
:response
,
success?:
false
,
code:
404
,
msg:
"No such file"
)
expect
(
File
).
to
receive
(
:read
).
and_return
(
"{
\"
geo_code
\"
:
\"
#{
Gitlab
::
Geo
::
Replication
::
FileUploader
::
FILE_NOT_FOUND_GEO_CODE
}
\"
}"
)
expect
(
Gitlab
::
HTTP
).
to
receive
(
:get
).
and_return
(
response
)
...
...
@@ -78,6 +79,7 @@ describe Gitlab::Geo::Replication::FileTransfer do
it
'returns a failed result'
do
expect
(
FileUtils
).
not_to
receive
(
:mv
).
with
(
anything
,
upload
.
absolute_path
).
and_call_original
response
=
double
(
:response
,
success?:
false
,
code:
404
,
msg:
'No such file'
)
expect
(
Gitlab
::
HTTP
).
to
receive
(
:get
).
and_return
(
response
)
result
=
subject
.
download_from_primary
...
...
ee/spec/lib/gitlab/geo/replication/job_artifact_downloader_spec.rb
View file @
002819ad
...
...
@@ -7,7 +7,7 @@ describe Gitlab::Geo::Replication::JobArtifactDownloader, :geo do
context
'with job artifact'
do
it
'returns a FileDownloader::Result object'
do
downloader
=
described_class
.
new
(
:job_artifact
,
job_artifact
.
id
)
result
=
Gitlab
::
Geo
::
Replication
::
Transfer
::
Result
.
new
(
success:
true
,
bytes_downloaded:
1
)
result
=
Gitlab
::
Geo
::
Replication
::
Base
Transfer
::
Result
.
new
(
success:
true
,
bytes_downloaded:
1
)
allow_any_instance_of
(
Gitlab
::
Geo
::
Replication
::
JobArtifactTransfer
)
.
to
receive
(
:download_from_primary
).
and_return
(
result
)
...
...
ee/spec/lib/gitlab/geo/replication/lfs_downloader_spec.rb
View file @
002819ad
...
...
@@ -7,7 +7,7 @@ describe Gitlab::Geo::Replication::LfsDownloader, :geo do
context
'with LFS object'
do
it
'returns a FileDownloader::Result object'
do
downloader
=
described_class
.
new
(
:lfs
,
lfs_object
.
id
)
result
=
Gitlab
::
Geo
::
Replication
::
Transfer
::
Result
.
new
(
success:
true
,
bytes_downloaded:
1
)
result
=
Gitlab
::
Geo
::
Replication
::
Base
Transfer
::
Result
.
new
(
success:
true
,
bytes_downloaded:
1
)
allow_any_instance_of
(
Gitlab
::
Geo
::
Replication
::
LfsTransfer
)
.
to
receive
(
:download_from_primary
).
and_return
(
result
)
...
...
ee/spec/services/geo/file_download_service_spec.rb
View file @
002819ad
...
...
@@ -446,6 +446,6 @@ describe Geo::FileDownloadService do
success:
success
,
primary_missing_file:
primary_missing_file
)
instance
=
double
(
"(instance of Gitlab::Geo::Replication::Transfer)"
,
download_from_primary:
result
)
allow
(
Gitlab
::
Geo
::
Replication
::
Transfer
).
to
receive
(
:new
).
and_return
(
instance
)
allow
(
Gitlab
::
Geo
::
Replication
::
Base
Transfer
).
to
receive
(
:new
).
and_return
(
instance
)
end
end
ee/spec/workers/geo/file_download_dispatch_worker_spec.rb
View file @
002819ad
...
...
@@ -312,7 +312,7 @@ describe Geo::FileDownloadDispatchWorker, :geo, :geo_fdw do
stub_const
(
'Geo::Scheduler::SchedulerWorker::DB_RETRIEVE_BATCH_SIZE'
,
5
)
secondary
.
update!
(
files_max_capacity:
2
)
result_object
=
double
(
:result
,
success:
true
,
bytes_downloaded:
100
,
primary_missing_file:
false
)
allow_any_instance_of
(
::
Gitlab
::
Geo
::
Replication
::
Transfer
).
to
receive
(
:download_from_primary
).
and_return
(
result_object
)
allow_any_instance_of
(
::
Gitlab
::
Geo
::
Replication
::
Base
Transfer
).
to
receive
(
:download_from_primary
).
and_return
(
result_object
)
avatar
=
fixture_file_upload
(
'spec/fixtures/dk.png'
)
create_list
(
:lfs_object
,
2
,
:with_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