diff options
author | Stan Hu <stanhu@gmail.com> | 2019-07-30 06:20:27 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-07-30 07:03:45 -0700 |
commit | 3b76d2982f2fdacdce5842c68ab3ba68b6cb7842 (patch) | |
tree | 1d4df8b9fac66ae93aa1b83445d2dc061355dc94 /spec/lib/gitlab/gitaly_client_spec.rb | |
parent | 11f82c891ab82620982ef157d3a6783ee56a6997 (diff) | |
download | gitlab-ce-3b76d2982f2fdacdce5842c68ab3ba68b6cb7842.tar.gz |
Fix exception handling in Gitaly autodetection
In SELinux, the file cannot be written, and `Errno::EACCES`, not
`Errno::ACCESS` is thrown.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/65328
Diffstat (limited to 'spec/lib/gitlab/gitaly_client_spec.rb')
-rw-r--r-- | spec/lib/gitlab/gitaly_client_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/lib/gitlab/gitaly_client_spec.rb b/spec/lib/gitlab/gitaly_client_spec.rb index e1d24ae8977..e9fb6c0125c 100644 --- a/spec/lib/gitlab/gitaly_client_spec.rb +++ b/spec/lib/gitlab/gitaly_client_spec.rb @@ -17,6 +17,16 @@ describe Gitlab::GitalyClient do }) end + describe '.filesystem_id_from_disk' do + it 'catches errors' do + [Errno::ENOENT, Errno::EACCES, JSON::ParserError].each do |error| + allow(File).to receive(:read).with(described_class.storage_metadata_file_path('default')).and_raise(error) + + expect(described_class.filesystem_id_from_disk('default')).to be_nil + end + end + end + describe '.stub_class' do it 'returns the gRPC health check stub' do expect(described_class.stub_class(:health_check)).to eq(::Grpc::Health::V1::Health::Stub) |