Point the unreachable-app test at port 1 #52

Merged
clawbot merged 1 commits from issue-51-unreachable-app-test into next 2026-10-04 06:39:09 +02:00
+2 -10
View File
@@ -5,7 +5,6 @@ import (
"bytes" "bytes"
"errors" "errors"
"io" "io"
"net"
"net/http" "net/http"
"slices" "slices"
"strings" "strings"
@@ -354,15 +353,8 @@ func TestRefusesHeadersOver32KiB(t *testing.T) {
func TestAnswers502WhenTheAppCannotBeReached(t *testing.T) { func TestAnswers502WhenTheAppCannotBeReached(t *testing.T) {
t.Parallel() t.Parallel()
listener, err := (&net.ListenConfig{}).Listen(t.Context(), "tcp", localhost+":0") // No test can listen on port 1: listening on port 0 gets one from 32768 up.
if err != nil { addr, out := startProxy(t, "http://"+localhost+":1", nil)
t.Fatalf("listen: %v", err)
}
closedAddr := listener.Addr().String()
_ = listener.Close()
addr, out := startProxy(t, "http://"+closedAddr, nil)
wantStatus(t, get(t, addr, "/"), http.StatusBadGateway) wantStatus(t, get(t, addr, "/"), http.StatusBadGateway)
wantLine(t, out.requestLine(t), http.StatusBadGateway, wantLine(t, out.requestLine(t), http.StatusBadGateway,