Commit 80a6a3e1 authored by Jordan's avatar Jordan Committed by Rémy Coutable

Use `system-err` if no failure/error message was given in JUnit output

Changelog: changed
parent 81db390a
......@@ -64,11 +64,11 @@ module Gitlab
def create_test_case(data, test_suite, job)
if data.key?('failure')
status = ::Gitlab::Ci::Reports::TestCase::STATUS_FAILED
system_output = data['failure']
system_output = data['failure'] || data['system_err']
attachment = attachment_path(data['system_out'])
elsif data.key?('error')
status = ::Gitlab::Ci::Reports::TestCase::STATUS_ERROR
system_output = data['error']
system_output = data['error'] || data['system_err']
attachment = attachment_path(data['system_out'])
elsif data.key?('skipped')
status = ::Gitlab::Ci::Reports::TestCase::STATUS_SKIPPED
......
......@@ -99,6 +99,19 @@ RSpec.describe Gitlab::Ci::Parsers::Test::Junit do
'Some failure'
end
context 'and has failure with no message but has system-err' do
let(:testcase_content) do
<<-EOF.strip_heredoc
<failure></failure>
<system-err>Some failure</system-err>
EOF
end
it_behaves_like '<testcase> XML parser',
::Gitlab::Ci::Reports::TestCase::STATUS_FAILED,
'Some failure'
end
context 'and has error' do
let(:testcase_content) { '<error>Some error</error>' }
......@@ -107,6 +120,19 @@ RSpec.describe Gitlab::Ci::Parsers::Test::Junit do
'Some error'
end
context 'and has error with no message but has system-err' do
let(:testcase_content) do
<<-EOF.strip_heredoc
<error></error>
<system-err>Some error</system-err>
EOF
end
it_behaves_like '<testcase> XML parser',
::Gitlab::Ci::Reports::TestCase::STATUS_ERROR,
'Some error'
end
context 'and has skipped' do
let(:testcase_content) { '<skipped/>' }
......
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