Improve error message when WaitUntil fails. (#1723)
This commit is contained in:
@@ -4,8 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -19,7 +17,9 @@ func WithTimeout(t *testing.T, f func() string) {
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
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):
|
case <-time.After(10 * time.Millisecond):
|
||||||
lastErr = f()
|
lastErr = f()
|
||||||
if lastErr == "" {
|
if lastErr == "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user