2019-07-07 11:18:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
RSpec.shared_examples 'logs kubernetes errors' do
|
2019-07-07 11:18:12 +05:30
|
|
|
let(:error_hash) do
|
|
|
|
{
|
|
|
|
service: service.class.name,
|
|
|
|
app_id: application.id,
|
|
|
|
project_ids: application.cluster.project_ids,
|
|
|
|
group_ids: [],
|
|
|
|
error_code: error_code
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'logs into kubernetes.log and Sentry' do
|
2020-01-01 13:55:28 +05:30
|
|
|
expect(Gitlab::ErrorTracking).to receive(:track_exception).with(
|
2019-07-07 11:18:12 +05:30
|
|
|
error,
|
2020-01-01 13:55:28 +05:30
|
|
|
hash_including(error_hash)
|
2019-07-07 11:18:12 +05:30
|
|
|
)
|
|
|
|
|
|
|
|
service.execute
|
|
|
|
end
|
|
|
|
end
|