From df98e9df3e1c1077c1fac6f662dc0492304abb4b Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 27 Nov 2026 17:57:38 -0800 Subject: [PATCH] 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 --- weed/admin/plugin/orphaned_execution_test.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/weed/admin/plugin/orphaned_execution_test.go b/weed/admin/plugin/orphaned_execution_test.go index afeed73af9..cc5cd910ae 100644 --- a/weed/admin/plugin/orphaned_execution_test.go +++ b/weed/admin/plugin/orphaned_execution_test.go @@ -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) } }