test(e2e-chain): fold stress results into report_data.json
report_build.py reads stress_results.json (when --stress-results given), adds a stress block (cases + by_axis), per-axis scaling-curve PNGs, aggregate stress headline metrics, and stress regression rows vs the previous run. Degrades to no stress section when the file is absent. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
import os
|
||||
import report_build as RB
|
||||
|
||||
_SR = {
|
||||
"overall": "PASS",
|
||||
"cases": [
|
||||
{"id": "ds_size_1000", "shape": "hub", "axis": "ds_signal_elements",
|
||||
"level": 1000, "status": "PASS", "survival": True, "clients": 1,
|
||||
"min_frames": 200, "marte_cpu_s": 12.8, "marte_rss_mb": 10.4,
|
||||
"hub_cpu_s": 2.33, "hub_rss_mb": 28.3, "zoom_count": 0, "zoom_fail": 0,
|
||||
"zoom_p50_ms": 0.0, "zoom_p95_ms": 0.0, "fails": []},
|
||||
{"id": "ds_size_4000", "shape": "hub", "axis": "ds_signal_elements",
|
||||
"level": 4000, "status": "PASS", "survival": True, "clients": 1,
|
||||
"min_frames": 180, "marte_cpu_s": 20.0, "marte_rss_mb": 14.0,
|
||||
"hub_cpu_s": 3.0, "hub_rss_mb": 40.0, "zoom_count": 0, "zoom_fail": 0,
|
||||
"zoom_p50_ms": 0.0, "zoom_p95_ms": 0.0, "fails": []},
|
||||
{"id": "hub_reqrate_50", "shape": "hub", "axis": "hub_zoom_reqrate_hz",
|
||||
"level": 50, "status": "PASS", "survival": True, "clients": 4,
|
||||
"min_frames": 100, "marte_cpu_s": 5.0, "marte_rss_mb": 12.0,
|
||||
"hub_cpu_s": 8.0, "hub_rss_mb": 60.0, "zoom_count": 400, "zoom_fail": 0,
|
||||
"zoom_p50_ms": 12.0, "zoom_p95_ms": 35.0, "fails": []},
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
def test_build_stress_groups_by_axis_sorted_by_level():
|
||||
st = RB.build_stress(_SR)
|
||||
assert st["overall"] == "PASS"
|
||||
assert len(st["cases"]) == 3
|
||||
assert set(st["by_axis"]) == {"ds_signal_elements", "hub_zoom_reqrate_hz"}
|
||||
levels = [c["level"] for c in st["by_axis"]["ds_signal_elements"]]
|
||||
assert levels == [1000, 4000] # sorted ascending
|
||||
|
||||
|
||||
def test_stress_headline_aggregates():
|
||||
st = RB.build_stress(_SR)
|
||||
hl = RB.stress_headline(st)
|
||||
assert hl["stress_pass"] == 3
|
||||
assert hl["stress_fail"] == 0
|
||||
assert hl["stress_max_hub_rss_mb"] == 60.0
|
||||
assert hl["stress_max_marte_rss_mb"] == 14.0
|
||||
assert hl["stress_max_zoom_p95_ms"] == 35.0
|
||||
|
||||
|
||||
def test_stress_plots_one_png_per_axis(tmp_path):
|
||||
st = RB.build_stress(_SR)
|
||||
made = RB.stress_plots(st["by_axis"], str(tmp_path))
|
||||
names = {os.path.basename(p) for p in made}
|
||||
assert "stress_ds_signal_elements.png" in names
|
||||
assert "stress_hub_zoom_reqrate_hz.png" in names
|
||||
for p in made:
|
||||
assert os.path.exists(p)
|
||||
|
||||
|
||||
def test_regression_includes_stress_when_present():
|
||||
curr = {"e2e_pass": 5, "stress_max_hub_rss_mb": 60.0}
|
||||
prev = {"e2e_pass": 5, "stress_max_hub_rss_mb": 50.0}
|
||||
labels = dict(RB._LABELS); labels["stress_max_hub_rss_mb"] = "Stress max hub RSS (MB)"
|
||||
directions = dict(RB._DIRECTION); directions["stress_max_hub_rss_mb"] = False
|
||||
rows = RB.regression(curr, prev, labels, directions)
|
||||
row = next(r for r in rows if r["key"] == "stress_max_hub_rss_mb")
|
||||
assert row["delta"] == 10.0
|
||||
assert row["better"] is False # RSS went up → worse
|
||||
Reference in New Issue
Block a user