rproxy tests: leave room for a busy host in five timing tests (closes #451)
check / check (push) Waiting to run
check / check (push) Waiting to run
Three tests that wait out a 2-second request or response time limit now use 5 seconds, so the request reaches the app before it runs out under load. The WebSocket one also renews its connection's deadline after the wait. The two breaker tests keep sending requests until one is kept from asking waf, instead of expecting the sixth to be. On a busy host the five asks can spread over more than five seconds, or the sixth can arrive after the open breaker's one-second wait. Their stand-ins for waf now fail every ask, so a request that asks never closes the breaker. Model: opus-5-5
This commit is contained in:
1 parent
11ac8aee50
commit
7002a5bfb0
2 files changed
+62
-54
No files matched your search
@@ -1262,7 +1262,9 @@ func TestAVisitorThatStopsALittleShortIsReadUntilTheRequestTimeLimit(
|
||||
) {
|
||||
t.Parallel()
|
||||
|
||||
const limit = 2 * time.Second
|
||||
// The app's answer arrives well within this limit, even on a busy host, and
|
||||
// the connection closes when it runs out, well before dial's deadline.
|
||||
const limit = 5 * time.Second
|
||||
|
||||
standIn := startWAF(t, allow)
|
||||
app := startApp(t, answerBeforeTheBody)
|
||||
@@ -1427,17 +1429,20 @@ func TestTheRequestTimeLimitDoesNotCutAnAnswerOnceTheAppHasTheRequest(
|
||||
|
||||
const answer = "the end of a long answer"
|
||||
|
||||
// The request reaches the app well within this limit, even on a busy host.
|
||||
const limit = 5 * time.Second
|
||||
|
||||
standIn := startWAF(t, allow)
|
||||
app := startApp(t, func(w http.ResponseWriter, r *http.Request) {
|
||||
_, _ = io.Copy(io.Discard, r.Body)
|
||||
_ = http.NewResponseController(w).Flush()
|
||||
|
||||
time.Sleep(2100 * time.Millisecond)
|
||||
time.Sleep(limit + 100*time.Millisecond)
|
||||
|
||||
_, _ = io.WriteString(w, answer)
|
||||
})
|
||||
addr, _ := startRProxy(t, standIn.URL, app.URL, map[string]string{
|
||||
maxRequestTime: "2000",
|
||||
maxRequestTime: strconv.FormatInt(limit.Milliseconds(), 10),
|
||||
})
|
||||
|
||||
got := visit(
|
||||
|
||||
Reference in new issue
Block a user