GRPC::Unavailable (< GRPC::BadStatus) is wrapped in a CommandError
This commit is contained in:
parent
7de6f742dc
commit
faabcbd3ae
2 changed files with 19 additions and 18 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue