Commit 54461011 authored by Shinya Maeda's avatar Shinya Maeda

Merge branch 'eb-test-report-parsing-errors' into 'master'

Return suite_errors in test suite comparer

See merge request gitlab-org/gitlab!54980
parents 04488229 eb9ed01d
......@@ -34,4 +34,16 @@ class TestSuiteComparerEntity < Grape::Entity
expose :resolved_errors, using: TestCaseEntity do |suite|
suite.limited_tests.resolved_errors
end
expose :suite_errors do |suite|
head_suite_error = suite.head_suite.suite_error
base_suite_error = suite.base_suite.suite_error
next unless head_suite_error.present? || base_suite_error.present?
{
head: head_suite_error,
base: base_suite_error
}
end
end
......@@ -26,7 +26,14 @@
"existing_failures": { "type": "array", "items": { "$ref": "test_case.json" } },
"new_errors": { "type": "array", "items": { "$ref": "test_case.json" } },
"resolved_errors": { "type": "array", "items": { "$ref": "test_case.json" } },
"existing_errors": { "type": "array", "items": { "$ref": "test_case.json" } }
"existing_errors": { "type": "array", "items": { "$ref": "test_case.json" } },
"suite_errors": {
"type": ["object", "null"],
"properties": {
"head": { "type": ["string", "null"] },
"base": { "type": ["string", "null"] }
}
}
},
"additionalProperties": false
}
......@@ -35,6 +35,7 @@ RSpec.describe TestSuiteComparerEntity do
end
expect(subject[:resolved_failures]).to be_empty
expect(subject[:existing_failures]).to be_empty
expect(subject[:suite_errors]).to be_nil
end
end
......@@ -56,6 +57,7 @@ RSpec.describe TestSuiteComparerEntity do
end
expect(subject[:resolved_failures]).to be_empty
expect(subject[:existing_failures]).to be_empty
expect(subject[:suite_errors]).to be_nil
end
end
......@@ -77,6 +79,7 @@ RSpec.describe TestSuiteComparerEntity do
expect(existing_failure[:execution_time]).to eq(test_case_failed.execution_time)
expect(existing_failure[:system_output]).to eq(test_case_failed.system_output)
end
expect(subject[:suite_errors]).to be_nil
end
end
......@@ -98,6 +101,47 @@ RSpec.describe TestSuiteComparerEntity do
expect(resolved_failure[:system_output]).to eq(test_case_success.system_output)
end
expect(subject[:existing_failures]).to be_empty
expect(subject[:suite_errors]).to be_nil
end
end
context 'when head suite has suite error' do
before do
allow(head_suite).to receive(:suite_error).and_return('some error')
end
it 'contains suite error for head suite' do
expect(subject[:suite_errors]).to eq(
head: 'some error',
base: nil
)
end
end
context 'when base suite has suite error' do
before do
allow(base_suite).to receive(:suite_error).and_return('some error')
end
it 'contains suite error for head suite' do
expect(subject[:suite_errors]).to eq(
head: nil,
base: 'some error'
)
end
end
context 'when base and head suite both have suite errors' do
before do
allow(head_suite).to receive(:suite_error).and_return('head error')
allow(base_suite).to receive(:suite_error).and_return('base error')
end
it 'contains suite error for head suite' do
expect(subject[:suite_errors]).to eq(
head: 'head error',
base: 'base error'
)
end
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