From 5e5824f9c5accf8e6f19380b7350d7733bef1fe7 Mon Sep 17 00:00:00 2001 From: Ted Yu Date: Sun, 15 Sep 2019 16:43:12 -0700 Subject: [PATCH] Check the length of recorder.invocations --- test/integration/apiserver/admissionwebhook/timeout_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/integration/apiserver/admissionwebhook/timeout_test.go b/test/integration/apiserver/admissionwebhook/timeout_test.go index ad845f52c02..6966e1fff11 100644 --- a/test/integration/apiserver/admissionwebhook/timeout_test.go +++ b/test/integration/apiserver/admissionwebhook/timeout_test.go @@ -327,8 +327,10 @@ func testWebhookTimeout(t *testing.T, watchCache bool) { } } - for _, invocation := range recorder.invocations[len(tt.expectInvocations):] { - t.Errorf("unexpected invocation of %s", invocation.path) + if len(recorder.invocations) > len(tt.expectInvocations) { + for _, invocation := range recorder.invocations[len(tt.expectInvocations):] { + t.Errorf("unexpected invocation of %s", invocation.path) + } } } })