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
faabcbd3
Commit
faabcbd3
authored
Aug 07, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GRPC::Unavailable (< GRPC::BadStatus) is wrapped in a CommandError
parent
7de6f742
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
18 deletions
+19
-18
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+1
-1
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+18
-17
No files found.
app/controllers/application_controller.rb
View file @
faabcbd3
...
...
@@ -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 @
faabcbd3
...
...
@@ -30,7 +30,8 @@ describe Repository, models: true do
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 @@ describe Repository, models: true do
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 @@ describe Repository, models: true do
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 @@ describe Repository, models: true do
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 @@ describe Repository, models: true do
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