20 lines
765 B
Python
20 lines
765 B
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
from testing.ci.summary import RunSummary, load_junit_summary, render_payload
|
||
|
|
|
||
|
|
|
||
|
|
def test_load_junit_summary_combines_suites(tmp_path: Path) -> None:
|
||
|
|
junit = tmp_path / "results.xml"
|
||
|
|
junit.write_text(
|
||
|
|
'<testsuites><testsuite tests="3" failures="1" errors="0" skipped="1"/></testsuites>'
|
||
|
|
)
|
||
|
|
|
||
|
|
summary = load_junit_summary([junit])
|
||
|
|
|
||
|
|
assert summary == RunSummary(tests=3, failures=1, errors=0, skipped=1)
|
||
|
|
payload = render_payload(suite="bstein-home", ok=2, failed=0, summary=summary)
|
||
|
|
assert 'platform_quality_gate_runs_total{suite="bstein-home",status="ok"} 2' in payload
|
||
|
|
assert 'bstein_home_quality_gate_tests_total{suite="bstein-home",result="skipped"} 1' in payload
|