Commit b245e198 authored by Marius Bobin's avatar Marius Bobin

Implement review feedback

parent 120f5fc2
......@@ -1983,8 +1983,9 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
let(:params) { { artifact_type: :archive, artifact_format: :zip } }
it 'does not store artifacts' do
allow_any_instance_of(JobArtifactUploader)
.to receive(:store!).and_raise(Errno::EIO)
allow_next_instance_of(JobArtifactUploader) do |uploader|
allow(uploader).to receive(:store!).and_raise(Errno::EIO)
end
upload_artifacts(file_upload, headers_with_token, params)
......
......@@ -121,10 +121,11 @@ describe Ci::CreateJobArtifactsService do
end
end
shared_examples 'object storage' do |klass, message, expected_message|
shared_examples 'rescues object storage error' do |klass, message, expected_message|
it "handles #{klass}" do
allow_any_instance_of(JobArtifactUploader)
.to receive(:store!).and_raise(klass, message)
allow_next_instance_of(JobArtifactUploader) do |uploader|
allow(uploader).to receive(:store!).and_raise(klass, message)
end
expect(Gitlab::ErrorTracking)
.to receive(:track_exception)
......@@ -138,8 +139,13 @@ describe Ci::CreateJobArtifactsService do
end
end
it_behaves_like 'object storage', Errno::EIO, 'some/path', 'Input/output error - some/path'
it_behaves_like 'object storage', Google::Apis::ServerError, 'Server error'
it_behaves_like 'object storage', Signet::RemoteServerError, 'The service is currently unavailable'
it_behaves_like 'rescues object storage error',
Errno::EIO, 'some/path', 'Input/output error - some/path'
it_behaves_like 'rescues object storage error',
Google::Apis::ServerError, 'Server error'
it_behaves_like 'rescues object storage error',
Signet::RemoteServerError, 'The service is currently unavailable'
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment