INNER CODE UNIT · Python
test_message_is_collapsed_raw_text
apache/ozone · dev-support/ci/test_junit_summary.py:66
def test_message_is_collapsed_raw_text(self):
with tempfile.TemporaryDirectory() as tmp:
path = self.write_report(tmp, "m/target/surefire-reports/TEST-x.xml")
cases = junit_summary.parse_report(path)
failed = next(c for c in cases if c.status == "failed")
self.assertEqual(failed.message, "expected: <1> but was: |2|")
flaky = next(c for c in cases if c.status == "flaky")
self.assertEqual(flaky.message, "Connection refused")
def test_message_keeps_junit5_tail_when_custom_message_floods(self):
# assertEquals(expected, actual, message) renders as "<custom message> ==> expected: ... but was: ...";
# some tests embed whole logs as the custom message, which would push the tail past the truncation limit
flood = "log line " * 100
xml = ('<testsuite><testcase name="t" classname="C" time="1">'
'<failure message="client log: %s ==> expected: <1> but was: <2>"/>'
'</testcase></testsuite>' % flood)
with tempfile.TemporaryDirectory() as tmp:
path = self.write_report(tmp, "m/target/surefire-reports/TEST-x.xml", content=xml)