forked from mtusi2026/mtusi2026lab7
fix(operations): preserve response processing deadlines and await routed API readiness
This commit is contained in:
@@ -51,6 +51,8 @@ func TestEarlyRejectionDoesNotForwardBodyAndAcceptedBodyStillStreams(t *testing.
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
// Request-body cleanup must not cancel legitimate processing.
|
||||
time.Sleep(2200 * time.Millisecond)
|
||||
w.Write(data)
|
||||
}))
|
||||
defer backend.Close()
|
||||
@@ -75,7 +77,11 @@ func TestEarlyRejectionDoesNotForwardBodyAndAcceptedBodyStillStreams(t *testing.
|
||||
}
|
||||
defer conn.Close()
|
||||
_ = conn.SetDeadline(time.Now().Add(5 * time.Second))
|
||||
fmt.Fprintf(conn, "POST / HTTP/1.1\r\nHost: synthetic\r\nConnection: close\r\nContent-Type: image/png\r\nContent-Length: %d\r\n\r\n", len(payload))
|
||||
connection := "keep-alive"
|
||||
if reject {
|
||||
connection = "close"
|
||||
}
|
||||
fmt.Fprintf(conn, "POST / HTTP/1.1\r\nHost: synthetic\r\nConnection: %s\r\nContent-Type: image/png\r\nContent-Length: %d\r\n\r\n", connection, len(payload))
|
||||
// A load balancer can finish writing before reading the early reply.
|
||||
if _, err := io.WriteString(conn, payload); err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user