From 8a2d037bc51c97758c0a68f2726f104953846cd5 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Wed, 25 Jul 2018 12:50:39 -0400 Subject: [PATCH] Make the timeout error more specific so users can find it This makes the error consistent with the timeout filter and also helps the user understand that they requested a specific timeout. --- staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest.go | 2 +- test/e2e/apimachinery/webhook.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest.go b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest.go index a941f6fbaf4..3f1b42327f7 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/rest.go @@ -202,7 +202,7 @@ func finishRequest(timeout time.Duration, fn resultFunc) (result runtime.Object, case p := <-panicCh: panic(p) case <-time.After(timeout): - return nil, errors.NewTimeoutError("request did not complete within allowed duration", 0) + return nil, errors.NewTimeoutError(fmt.Sprintf("request did not complete within requested timeout %s", timeout), 0) } } diff --git a/test/e2e/apimachinery/webhook.go b/test/e2e/apimachinery/webhook.go index f5647aa989e..d44097f5285 100644 --- a/test/e2e/apimachinery/webhook.go +++ b/test/e2e/apimachinery/webhook.go @@ -576,7 +576,7 @@ func testWebhook(f *framework.Framework) { pod = hangingPod(f) _, err = client.CoreV1().Pods(f.Namespace.Name).Create(pod) Expect(err).NotTo(BeNil()) - expectedTimeoutErr := "request did not complete within allowed duration" + expectedTimeoutErr := "Timeout: request did not complete within requested timeout 30s" if !strings.Contains(err.Error(), expectedTimeoutErr) { framework.Failf("expect timeout error %q, got %q", expectedTimeoutErr, err.Error()) }