diff --git a/pkg/testing/tools/tools.go b/pkg/testing/tools/tools.go index 9f544fbc121..98e037a8565 100644 --- a/pkg/testing/tools/tools.go +++ b/pkg/testing/tools/tools.go @@ -128,7 +128,7 @@ func InstallAgentForPolicy(t *testing.T, ctx context.Context, timeout := 5 * time.Minute if deadline, ok := ctx.Deadline(); ok { - timeout = deadline.Sub(time.Now()) + timeout = time.Until(deadline) } // Wait for Agent to be healthy require.Eventually(