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
50872bcc
Commit
50872bcc
authored
Jun 07, 2018
by
Micaël Bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix the failing spec
parent
a667de18
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
app/uploaders/object_storage.rb
app/uploaders/object_storage.rb
+2
-1
spec/support/shared_examples/uploaders/object_storage_shared_examples.rb
...ared_examples/uploaders/object_storage_shared_examples.rb
+2
-2
spec/uploaders/object_storage_spec.rb
spec/uploaders/object_storage_spec.rb
+2
-2
No files found.
app/uploaders/object_storage.rb
View file @
50872bcc
...
...
@@ -9,6 +9,7 @@ module ObjectStorage
RemoteStoreError
=
Class
.
new
(
StandardError
)
UnknownStoreError
=
Class
.
new
(
StandardError
)
ObjectStorageUnavailable
=
Class
.
new
(
StandardError
)
ExclusiveLeaseTaken
=
Class
.
new
(
StandardError
)
TMP_UPLOAD_PATH
=
'tmp/uploads'
.
freeze
...
...
@@ -378,7 +379,7 @@ module ObjectStorage
def
with_exclusive_lease
lease_key
=
exclusive_lease_key
uuid
=
Gitlab
::
ExclusiveLease
.
new
(
lease_key
,
timeout:
1
.
hour
.
to_i
).
try_obtain
raise
"Exclusive lease
#{
lease_key
}
already taken."
unless
uuid
raise
ExclusiveLeaseTaken
,
"Exclusive lease
#{
lease_key
}
already taken."
unless
uuid
yield
uuid
ensure
...
...
spec/support/shared_examples/uploaders/object_storage_shared_examples.rb
View file @
50872bcc
...
...
@@ -85,13 +85,13 @@ shared_examples "migrates" do |to_store:, from_store: nil|
it
'does not execute migrate!'
do
expect
(
subject
).
not_to
receive
(
:unsafe_migrate!
)
expect
{
migrate
(
to
)
}.
to
raise_error
(
'exclusive lease already taken'
)
expect
{
migrate
(
to
)
}.
to
raise_error
(
ObjectStorage
::
ExclusiveLeaseTaken
)
end
it
'does not execute use_file'
do
expect
(
subject
).
not_to
receive
(
:unsafe_use_file
)
expect
{
subject
.
use_file
}.
to
raise_error
(
'exclusive lease already taken'
)
expect
{
subject
.
use_file
}.
to
raise_error
(
ObjectStorage
::
ExclusiveLeaseTaken
)
end
after
do
...
...
spec/uploaders/object_storage_spec.rb
View file @
50872bcc
...
...
@@ -321,7 +321,7 @@ describe ObjectStorage do
when_file_is_in_use
do
expect
(
uploader
).
not_to
receive
(
:unsafe_migrate!
)
expect
{
uploader
.
migrate!
(
described_class
::
Store
::
REMOTE
)
}.
to
raise_error
(
'exclusive lease already taken'
)
expect
{
uploader
.
migrate!
(
described_class
::
Store
::
REMOTE
)
}.
to
raise_error
(
ObjectStorage
::
ExclusiveLeaseTaken
)
end
end
...
...
@@ -329,7 +329,7 @@ describe ObjectStorage do
when_file_is_in_use
do
expect
(
uploader
).
not_to
receive
(
:unsafe_use_file
)
expect
{
uploader
.
use_file
}.
to
raise_error
(
'exclusive lease already taken'
)
expect
{
uploader
.
use_file
}.
to
raise_error
(
ObjectStorage
::
ExclusiveLeaseTaken
)
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