admin: wait for the failed record in the worker-restart orphan test (#13079)

handleJobCompleted hands the completion to the dispatcher before it
updates the tracked job, so the test could read the record while it
still said assigned.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 authored and GitHub committed 2026-11-27 17:57:38 -08:00
1 parent 2e81c0b7c0
commit df98e9df3e
1 file changed
+3 -6
+3 -6
View File
@@ -110,12 +110,9 @@ func TestExecutionFailsWhenWorkerRestartsWithoutJob(t *testing.T) {
t.Fatal("dispatch was not failed after its worker restarted without the job")
}
tracked, ok := p.GetTrackedJob(jobID)
if !ok || tracked == nil {
t.Fatalf("job %s is not tracked", jobID)
}
if tracked.State != StateFailed || tracked.RequestID != requestID {
t.Fatalf("expected request %s failed, got state=%s request=%s", requestID, tracked.State, tracked.RequestID)
// the dispatcher gets the completion before the record is updated
if tracked := waitTrackedState(t, p, jobID, StateFailed); tracked.RequestID != requestID {
t.Fatalf("expected request %s failed, got request %s", requestID, tracked.RequestID)
}
}