rproxy tests: leave room for a busy host in five timing tests (closes #451)
check / check (push) Failing after 2m8s
check / check (push) Failing after 2m8s
Three tests that wait out a 2- or 3-second request time limit now use 5 seconds, so the request reaches the app before it runs out under load. The WebSocket test also uses 5-second limits, and renews its connection's deadline after the wait. TestFiveFailedAsksKeepTheNextRequestFromAskingWAF stops the breaker's clock like TestAnswersThatCannotBePassedOnOpenTheBreaker. Model: opus-5-5
This commit is contained in:
1 parent
419ee1c441
commit
bfdf17126c
2 files changed
+34
-14
No files matched your search
@@ -1452,14 +1452,18 @@ func TestFiveFailedAsksKeepTheNextRequestFromAskingWAF(t *testing.T) {
|
||||
|
||||
greet(w, r)
|
||||
})
|
||||
addr, out := startRProxy(
|
||||
t,
|
||||
standIn.URL,
|
||||
app.URL,
|
||||
map[string]string{
|
||||
wafBackendTimeout: "200",
|
||||
},
|
||||
out := &output{}
|
||||
server := newServer(
|
||||
t, standIn.URL, app.URL,
|
||||
map[string]string{wafBackendTimeout: "200"},
|
||||
out, out,
|
||||
)
|
||||
// The breaker's clock stands still, as in
|
||||
// TestAnswersThatCannotBePassedOnOpenTheBreaker: on a slow host, the five
|
||||
// failures could take more than five seconds, and the next request could
|
||||
// come more than a second later.
|
||||
server.StopBreakerClock(time.Now())
|
||||
addr := serve(t, server)
|
||||
|
||||
// An ask can time out before it reaches the stand-in, so these
|
||||
// may leave fewer than five questions, or leave some late.
|
||||
@@ -1831,11 +1835,15 @@ func TestWaitForReportsWaitsForAReportBeingSent(t *testing.T) {
|
||||
func TestReportOfAWebSocketCountsWhatItCarried(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// The app's answer to the upgrade arrives well within these limits, even on a
|
||||
// busy host.
|
||||
const limit = 5 * time.Second
|
||||
|
||||
standIn := startWAF(t, allow)
|
||||
app := startApp(t, echoAfterUpgrade)
|
||||
addr, out := startRProxy(t, standIn.URL, app.URL, map[string]string{
|
||||
maxRequestTime: "2000",
|
||||
maxResponseTime: "2000",
|
||||
maxRequestTime: strconv.FormatInt(limit.Milliseconds(), 10),
|
||||
maxResponseTime: strconv.FormatInt(limit.Milliseconds(), 10),
|
||||
})
|
||||
|
||||
conn := dial(t, addr)
|
||||
@@ -1860,7 +1868,10 @@ func TestReportOfAWebSocketCountsWhatItCarried(t *testing.T) {
|
||||
}
|
||||
|
||||
// Past both time limits, the connection still carries what is sent.
|
||||
time.Sleep(2100 * time.Millisecond)
|
||||
time.Sleep(limit + 100*time.Millisecond)
|
||||
|
||||
// dial's deadline ran from before the upgrade and this wait.
|
||||
_ = conn.SetDeadline(time.Now().Add(waitLimit))
|
||||
|
||||
const message = "still here\n"
|
||||
|
||||
|
||||
Reference in new issue
Block a user