Skip to content
Snippets Groups Projects
Commit faabcbd3 authored by Bob Van Landuyt's avatar Bob Van Landuyt
Browse files

GRPC::Unavailable (< GRPC::BadStatus) is wrapped in a CommandError

parent 7de6f742
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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)
 
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment