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.
This commit is contained in:
Clayton Coleman 2018-07-25 12:50:39 -04:00
parent cefca66b1f
commit 8a2d037bc5
No known key found for this signature in database
GPG Key ID: 3D16906B4F1C5CB3
2 changed files with 2 additions and 2 deletions

View File

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

View File

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