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.
parent cefca66b
...@@ -202,7 +202,7 @@ func finishRequest(timeout time.Duration, fn resultFunc) (result runtime.Object, ...@@ -202,7 +202,7 @@ func finishRequest(timeout time.Duration, fn resultFunc) (result runtime.Object,
case p := <-panicCh: case p := <-panicCh:
panic(p) panic(p)
case <-time.After(timeout): 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)
} }
} }
......
...@@ -576,7 +576,7 @@ func testWebhook(f *framework.Framework) { ...@@ -576,7 +576,7 @@ func testWebhook(f *framework.Framework) {
pod = hangingPod(f) pod = hangingPod(f)
_, err = client.CoreV1().Pods(f.Namespace.Name).Create(pod) _, err = client.CoreV1().Pods(f.Namespace.Name).Create(pod)
Expect(err).NotTo(BeNil()) 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) { if !strings.Contains(err.Error(), expectedTimeoutErr) {
framework.Failf("expect timeout error %q, got %q", expectedTimeoutErr, err.Error()) framework.Failf("expect timeout error %q, got %q", expectedTimeoutErr, err.Error())
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment