Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
297b06420f61
Commit
faabcbd3
authored
Aug 07, 2017
by
Bob Van Landuyt
Browse files
GRPC::Unavailable (< GRPC::BadStatus) is wrapped in a CommandError
parent
9677e7c7592c
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/controllers/application_controller.rb
View file @
297b0642
...
...
@@ -52,7 +52,7 @@ class ApplicationController < ActionController::Base
head
:forbidden
,
retry_after:
Gitlab
::
Auth
::
UniqueIpsLimiter
.
config
.
unique_ips_limit_time_window
end
rescue_from
Gitlab
::
Git
::
Storage
::
Inaccessible
,
GRPC
::
Unavailable
do
|
exception
|
rescue_from
Gitlab
::
Git
::
Storage
::
Inaccessible
,
GRPC
::
Unavailable
,
Gitlab
::
Git
::
CommandError
do
|
exception
|
Raven
.
capture_exception
(
exception
)
if
sentry_enabled?
log_exception
(
exception
)
...
...
spec/models/repository_spec.rb
View file @
297b0642
...
...
@@ -30,7 +30,8 @@
def
expect_to_raise_storage_error
expect
{
yield
}.
to
raise_error
do
|
exception
|
expect
(
exception
.
class
).
to
be_in
([
Gitlab
::
Git
::
Storage
::
Inaccessible
,
GRPC
::
Unavailable
])
storage_exceptions
=
[
Gitlab
::
Git
::
Storage
::
Inaccessible
,
Gitlab
::
Git
::
CommandError
,
GRPC
::
Unavailable
]
expect
(
exception
.
class
).
to
be_in
(
storage_exceptions
)
end
end
...
...
@@ -158,6 +159,14 @@ def expect_to_raise_storage_error
subject
{
repository
.
last_commit_for_path
(
sample_commit
.
id
,
'.gitignore'
).
id
}
it
{
is_expected
.
to
eq
(
'c1acaa58bbcbc3eafe538cb8274ba387047b69f8'
)
}
describe
'when storage is broken'
,
broken_storage:
true
do
it
'should raise a storage error'
do
expect_to_raise_storage_error
do
broken_repository
.
last_commit_id_for_path
(
sample_commit
.
id
,
'.gitignore'
)
end
end
end
end
context
'when Gitaly feature last_commit_for_path is enabled'
do
...
...
@@ -167,14 +176,6 @@ def expect_to_raise_storage_error
context
'when Gitaly feature last_commit_for_path is disabled'
,
skip_gitaly_mock:
true
do
it_behaves_like
'getting last commit for path'
end
describe
'when storage is broken'
,
broken_storage:
true
do
it
'should raise a storage error'
do
expect_to_raise_storage_error
do
broken_repository
.
last_commit_for_path
(
sample_commit
.
id
,
'.gitignore'
).
id
end
end
end
end
describe
'#last_commit_id_for_path'
do
...
...
@@ -192,6 +193,14 @@ def expect_to_raise_storage_error
expect
(
cache
).
to
receive
(
:fetch
).
with
(
key
).
and_return
(
'c1acaa5'
)
is_expected
.
to
eq
(
'c1acaa5'
)
end
describe
'when storage is broken'
,
broken_storage:
true
do
it
'should raise a storage error'
do
expect_to_raise_storage_error
do
broken_repository
.
last_commit_for_path
(
sample_commit
.
id
,
'.gitignore'
).
id
end
end
end
end
context
'when Gitaly feature last_commit_for_path is enabled'
do
...
...
@@ -201,14 +210,6 @@ def expect_to_raise_storage_error
context
'when Gitaly feature last_commit_for_path is disabled'
,
skip_gitaly_mock:
true
do
it_behaves_like
'getting last commit ID for path'
end
describe
'when storage is broken'
,
broken_storage:
true
do
it
'should raise a storage error'
do
expect_to_raise_storage_error
do
broken_repository
.
last_commit_id_for_path
(
sample_commit
.
id
,
'.gitignore'
)
end
end
end
end
describe
'#commits'
do
...
...
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