test(jobs): runner lifecycle integration tests — claim, start, progress, complete, fail #109

Open
opened 2026-02-15 10:54:56 +00:00 by forbes · 0 comments
Owner

Ref: docs/WORKERS.md §5

The existing job handler tests cover definition listing, job creation/cancellation, and runner registration, but the runner claim → start → progress → complete/fail flow is untested.

Requirements

Add integration tests for the full runner lifecycle:

  • TestRunnerClaimJob — Register runner, create pending job, claim it, verify job transitions to claimed
  • TestRunnerStartAndCompleteJob — Claim → start → progress updates → complete with result
  • TestRunnerFailJob — Claim → start → fail with error message
  • TestRunnerClaimWithTags — Runner with [create, linux] claims job requiring [create], runner with [export] cannot
  • TestRunnerClaimNoJobs — Claim when no pending jobs returns empty/404
  • TestRunnerHeartbeat — Verify heartbeat updates runner status
  • TestRunnerAppendAndGetLogs — Append log entries during job, retrieve via GET /api/jobs/{id}/logs
  • TestJobTimeout — Job expires, timeout sweeper marks it failed

Uses existing newTestServer pattern with RequireRunnerAuth middleware.

**Ref:** docs/WORKERS.md §5 The existing job handler tests cover definition listing, job creation/cancellation, and runner registration, but the **runner claim → start → progress → complete/fail flow is untested**. ## Requirements Add integration tests for the full runner lifecycle: - [ ] `TestRunnerClaimJob` — Register runner, create pending job, claim it, verify job transitions to `claimed` - [ ] `TestRunnerStartAndCompleteJob` — Claim → start → progress updates → complete with result - [ ] `TestRunnerFailJob` — Claim → start → fail with error message - [ ] `TestRunnerClaimWithTags` — Runner with `[create, linux]` claims job requiring `[create]`, runner with `[export]` cannot - [ ] `TestRunnerClaimNoJobs` — Claim when no pending jobs returns empty/404 - [ ] `TestRunnerHeartbeat` — Verify heartbeat updates runner status - [ ] `TestRunnerAppendAndGetLogs` — Append log entries during job, retrieve via `GET /api/jobs/{id}/logs` - [ ] `TestJobTimeout` — Job expires, timeout sweeper marks it failed Uses existing `newTestServer` pattern with `RequireRunnerAuth` middleware.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/silo#109