Skip to content

Commit

Permalink
controllers: fix a flaky test (#6069)
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Santos <[email protected]>
  • Loading branch information
nicks authored Mar 10, 2023
1 parent c314661 commit 7935726
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions internal/controllers/core/cmd/execer_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ echo BACKGROUND $!
require.NoError(t, err)

// Old unix trick - signal to check if the process is still alive.
time.Sleep(10 * time.Millisecond)
err = grandkid.Signal(syscall.SIGCONT)
if assert.Error(t, err) {
assert.Contains(t, err.Error(), "process already finished")
}
assert.Eventually(t, func() bool {
err := grandkid.Signal(syscall.SIGCONT)
return err != nil && strings.Contains(err.Error(), "process already finished")
}, time.Second, time.Millisecond)
}

0 comments on commit 7935726

Please sign in to comment.