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
9c729fca
Commit
9c729fca
authored
Jun 28, 2019
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get LfsTransfer spec working
parent
a74d97d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
ee/spec/lib/gitlab/geo/lfs_transfer_spec.rb
ee/spec/lib/gitlab/geo/lfs_transfer_spec.rb
+6
-10
No files found.
ee/spec/lib/gitlab/geo/lfs_transfer_spec.rb
View file @
9c729fca
require
'spec_helper'
describe
Gitlab
::
Geo
::
Transfer
do
describe
Gitlab
::
Geo
::
Lfs
Transfer
do
include
::
EE
::
GeoHelpers
set
(
:primary_node
)
{
create
(
:geo_node
,
:primary
)
}
set
(
:secondary_node
)
{
create
(
:geo_node
)
}
set
(
:lfs_object
)
{
create
(
:lfs_object
,
:with_file
)
}
let
(
:lfs_object_file_path
)
{
lfs_object
.
file
.
path
}
let
(
:url
)
{
primary_node
.
geo_transfers_url
(
:lfs
,
lfs_object
.
id
.
to_s
)
}
let
(
:content
)
{
SecureRandom
.
random_bytes
(
10
)
}
let
(
:size
)
{
File
.
stat
(
lfs_object
.
file
.
path
).
size
}
subject
do
described_class
.
new
(
:lfs
,
lfs_object
.
id
,
lfs_object_file_path
,
{
sha256:
lfs_object
.
oid
})
described_class
.
new
(
lfs_object
)
end
context
'#download_from_primary'
do
...
...
@@ -25,9 +21,9 @@ describe Gitlab::Geo::Transfer do
context
'when the destination filename is a directory'
do
it
'returns a failed result'
do
transfer
=
described_class
.
new
(
:lfs
,
lfs_object
.
id
,
'/tmp'
,
{
sha256:
lfs_object
.
id
}
)
expect
(
lfs_object
).
to
receive
(
:file
).
and_return
(
double
(
path:
'/tmp'
)
)
result
=
transfer
.
download_from_primary
result
=
subject
.
download_from_primary
expect_result
(
result
,
success:
false
,
bytes_downloaded:
0
,
primary_missing_file:
false
)
end
...
...
@@ -88,9 +84,9 @@ describe Gitlab::Geo::Transfer do
end
context
"invalid path"
do
let
(
:lfs_object_file_path
)
{
'/foo/bar'
}
it
'logs an error if the destination directory could not be created'
do
expect
(
lfs_object
).
to
receive
(
:file
).
and_return
(
double
(
path:
'/foo/bar'
))
allow
(
FileUtils
).
to
receive
(
:mkdir_p
)
{
raise
Errno
::
EEXIST
}
expect
(
subject
).
to
receive
(
:log_error
).
with
(
"unable to create directory /foo: File exists"
)
...
...
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