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 1ce55e3afe 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 <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2022-03-22 19:52:13 -07:00
parent e3ed3ba7c9
commit 8820f4d381

View File

@ -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))