Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions scripts/__tests__/test_pr_latency.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def job(i, name, status="success", end=finish):
job(21, "Self-hosted runner registration preflight", end=failed),
{
**job(22, "Unity 6000 all modes"),
"runner_name": "assigned",
"created_at": failed,
"started_at": "2026-01-02T10:05:00Z",
"steps": [
{"name": "Set up job", "started_at": "2026-01-02T10:05:00Z"}
],
Expand Down Expand Up @@ -90,6 +93,17 @@ def job(i, name, status="success", end=finish):
(recovered,) = report.collect("owner/repo", 40)
self.assertEqual(row, recovered)
responses[f"{root}/actions/workflows/ci.yml/runs"] = []
unity_jobs = responses[f"{root}/actions/runs/2/attempts/1/jobs"]
unity_jobs[0] = job(20, "Unity CI Success", None, None)
unity_jobs.append(
{
**job(23, "Unity 2021 all modes", None, None),
"runner_name": "",
"created_at": failed,
"started_at": failed,
"steps": None,
}
)
with patch.object(
report, "pages", side_effect=lambda path, *a, **kw: iter(responses[path])
):
Expand All @@ -98,6 +112,9 @@ def job(i, name, status="success", end=finish):
("missing or ambiguous", None), (orphan["outcome"], orphan["seconds"])
)
self.assertEqual(240, row["native_jobs"][0]["preflight_to_setup_seconds"])
self.assertEqual([240], row["queue_seconds"])
self.assertEqual([240], orphan["queue_seconds"])
self.assertIsNone(orphan["native_jobs"][1]["preflight_to_setup_seconds"])
self.assertTrue(row["retried"])
self.assertEqual(
("success", 420, 60),
Expand Down
3 changes: 2 additions & 1 deletion scripts/pr_latency.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ def branch_prs(origin, branch):
instant(j["started_at"]) - instant(j["created_at"])
).total_seconds()
for j in native
if j.get("created_at") and j.get("started_at")
# GitHub can fill in started_at while a job still has no runner.
if j.get("runner_name") and j.get("created_at") and j.get("started_at")
],
"native_jobs": native,
}
Expand Down
Loading