@@ -331,6 +331,35 @@ func TestProcessSyncEvents_JobWaitFailed(t *testing.T) {
331331 assert .True (t , exists , "observedDeployments should be populated from submitted records on wait failure" )
332332}
333333
334+ func TestProcessSyncEvents_JobStatusFailed (t * testing.T ) {
335+ t .Parallel ()
336+ digest := "sha256:abc123"
337+ poster := & mockPoster {
338+ jobResp : & deploymentrecord.JobResponse {JobID : 42 },
339+ jobStatus : & deploymentrecord.JobStatus {
340+ JobID : 42 ,
341+ Status : "failed" ,
342+ Errors : []deploymentrecord.JobError {
343+ {Name : "nginx" , Cause : "error" },
344+ },
345+ },
346+ }
347+ ctrl := newTestController (poster )
348+ ctrl .workloadResolver = & mockResolver {name : "test-deploy" }
349+ pod := makeTestPod ("app" , "test-deploy-abc123" , digest , "ReplicaSet" )
350+
351+ err := ctrl .processSyncEvents (context .Background (), []any {pod })
352+ require .NoError (t , err , "failed job should not block startup" )
353+ assert .Equal (t , 1 , poster .getCreateClusterJobCalls ())
354+ assert .Equal (t , 1 , poster .getWaitForClusterJobCalls ())
355+
356+ // observedDeployments should NOT be populated — records may not have been
357+ // created, and suppressing re-posts would delay self-healing.
358+ cacheKey := getCacheKey (EventCreated , "default/test-deploy/app" , digest )
359+ _ , exists := ctrl .observedDeployments .Get (cacheKey )
360+ assert .False (t , exists , "observedDeployments should not be populated when job failed" )
361+ }
362+
334363func TestMakeSyncRecords_TerminalJobPodIncluded (t * testing.T ) {
335364 t .Parallel ()
336365 digest := "sha256:terminal-job-digest"
0 commit comments