From 93d6651d60c21a10b2edb8b884aaea70c9afb1fe Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 18 May 2023 14:10:40 -0700 Subject: [PATCH] Improve error message when WaitUntil fails. (#1723) --- pkg/testutils/timeout.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/testutils/timeout.go b/pkg/testutils/timeout.go index ab641471..af70a48f 100644 --- a/pkg/testutils/timeout.go +++ b/pkg/testutils/timeout.go @@ -4,8 +4,6 @@ import ( "context" "testing" "time" - - "github.com/stretchr/testify/require" ) var ( @@ -19,7 +17,9 @@ func WithTimeout(t *testing.T, f func() string) { for { select { case <-ctx.Done(): - require.Empty(t, lastErr) + if lastErr != "" { + t.Fatalf("did not reach expected state after %v: %s", ConnectTimeout, lastErr) + } case <-time.After(10 * time.Millisecond): lastErr = f() if lastErr == "" {