From 8820f4d3813a34158bcb65e31a030ccb9f7927c5 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 22 Mar 2022 19:52:13 -0700 Subject: [PATCH] TestWatchRestartsIfTimeoutNotReached: fix This fixes the following error: > test/integration/apimachinery/watch_restart_test.go:232:5: call to (*T).Fatalf from a non-test goroutine Update: the previous fix (commit 1ce55e3afe761bca0e that uses panic) looks way too severe; it seems it is enough to call t.Errorf and return from goroutine. The test will time out and fail anyway. Signed-off-by: Kir Kolyshkin --- test/integration/apimachinery/watch_restart_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/integration/apimachinery/watch_restart_test.go b/test/integration/apimachinery/watch_restart_test.go index bccfeef6c40..fe599a3c152 100644 --- a/test/integration/apimachinery/watch_restart_test.go +++ b/test/integration/apimachinery/watch_restart_test.go @@ -121,7 +121,8 @@ func TestWatchRestartsIfTimeoutNotReached(t *testing.T) { patch := fmt.Sprintf(`{"metadata": {"annotations": {"count": "%d"}}}`, counter) _, err := c.CoreV1().Secrets(secret.Namespace).Patch(context.TODO(), secret.Name, types.StrategicMergePatchType, []byte(patch), metav1.PatchOptions{}) if err != nil { - panic(fmt.Sprintf("Failed to patch secret: %v", err)) + t.Errorf("Failed to patch secret: %v", err) + return } *referenceOutput = append(*referenceOutput, fmt.Sprintf("%d", counter))