fix tests

This commit is contained in:
WeidiDeng
2026-04-21 14:55:46 +08:00
committed by Francis Lavoie
parent 6ba6cf5d13
commit f970f397e2
2 changed files with 4 additions and 3 deletions

View File

@@ -226,9 +226,6 @@ func TestResponseRecorderSwitchingProtocolsIsHijackAware(t *testing.T) {
})
rr.WriteHeader(http.StatusSwitchingProtocols)
if rr.Buffered() {
t.Fatal("101 switching protocols response should not remain buffered")
}
if rr.Status() != http.StatusSwitchingProtocols {
t.Fatalf("status = %d, want %d", rr.Status(), http.StatusSwitchingProtocols)
}
@@ -246,6 +243,9 @@ func TestResponseRecorderSwitchingProtocolsIsHijackAware(t *testing.T) {
}
defer conn.Close()
if rr.Buffered() {
t.Fatal("hijacked response should not remain buffered")
}
if rr.DetachAfterHijack(true) {
t.Fatal("response recorder should report hijacked state by returning false")
}

View File

@@ -173,6 +173,7 @@ func TestHandlerCleanupRetainModeClosesOnlyRemovedUpstreams(t *testing.T) {
})
ts := newTunnelState(caddy.Log(), 0)
registerDetachedTunnelStates(ts)
connA := newTrackingReadWriteCloser()
connB := newTrackingReadWriteCloser()
ts.registerConnection(connA, nil, true, upstreamA)