mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 23:15:14 +00:00
Revert "use default value when the specified timeout is 0s"
This reverts commit 0090e27bd3
.
This commit is contained in:
parent
63d2bf72fa
commit
3e21057070
@ -69,10 +69,7 @@ func WithRequestDeadline(handler http.Handler, longRunning request.LongRunningRe
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the user has specified a timeout of 0s, this means no timeout, so we should use the maximum timeout allowed.
|
timeout = userSpecifiedTimeout
|
||||||
if userSpecifiedTimeout != 0 {
|
|
||||||
timeout = userSpecifiedTimeout
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(ctx, timeout)
|
ctx, cancel := context.WithTimeout(ctx, timeout)
|
||||||
|
@ -94,15 +94,6 @@ func TestWithRequestDeadline(t *testing.T) {
|
|||||||
deadlineExpected: 14 * time.Second, // to account for the delay in verification
|
deadlineExpected: 14 * time.Second, // to account for the delay in verification
|
||||||
statusCodeExpected: http.StatusOK,
|
statusCodeExpected: http.StatusOK,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "the specified timeout is 0s, default deadline is expected to be set",
|
|
||||||
requestURL: "/api/v1/namespaces?timeout=0s",
|
|
||||||
longRunning: false,
|
|
||||||
handlerCallCountExpected: 1,
|
|
||||||
hasDeadlineExpected: true,
|
|
||||||
deadlineExpected: requestTimeoutMaximum - time.Second, // to account for the delay in verification
|
|
||||||
statusCodeExpected: http.StatusOK,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "the user does not specify any request timeout, default deadline is expected to be set",
|
name: "the user does not specify any request timeout, default deadline is expected to be set",
|
||||||
requestURL: "/api/v1/namespaces?timeout=",
|
requestURL: "/api/v1/namespaces?timeout=",
|
||||||
|
Loading…
Reference in New Issue
Block a user