Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
230248d058 |
No files matched your search
@@ -153,14 +153,10 @@ func TestUnsetRouteWatchChangesNothing(t *testing.T) {
|
||||
func TestUnreachableRouteWatchLetsTheRequestThroughAndSaysWhy(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// A stand-in that is closed at once, so that the port refuses connections.
|
||||
dead := httptest.NewServer(http.NotFoundHandler())
|
||||
url := dead.URL
|
||||
|
||||
dead.Close()
|
||||
|
||||
// Another test can take a closed server's port at once, so routewatch's
|
||||
// address here is a multicast address, to which TCP cannot connect.
|
||||
s, _, _ := startWithClock(t, "", map[string]string{
|
||||
lookupSource: off, routeWatchURL: url,
|
||||
lookupSource: off, routeWatchURL: "http://224.0.0.1",
|
||||
})
|
||||
|
||||
wantTagsMissing(t, s.get(fromDE, http.StatusOK, requestlog.ActionForward),
|
||||
|
||||
@@ -239,12 +239,17 @@ func TestAnswerRoutewatchCannotBeTakenFromFails(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRefusedConnectionFailsTheQueryAndTheLogOmitsTheClient(t *testing.T) {
|
||||
func TestUnreachableRoutewatchFailsTheQueryAndTheLogOmitsTheClient(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
f := newFixture(t, answering(routedAnswer))
|
||||
|
||||
f.server.Close()
|
||||
// Another test can take a closed server's port at once, so routewatch's
|
||||
// address here is a multicast address, to which TCP cannot connect.
|
||||
f.client = routewatch.New(routewatch.Params{
|
||||
URL: "http://224.0.0.1/", Now: f.clk.Now,
|
||||
ProcessLog: slog.New(slog.NewTextHandler(f.log, nil)),
|
||||
})
|
||||
|
||||
f.route()
|
||||
f.waitFor(routewatch.RequestFailed)
|
||||
|
||||
@@ -975,9 +975,20 @@ func TestStalledRemoteLogEndpointHoldsUpNoRequest(t *testing.T) {
|
||||
t.Errorf("no line dropped in the metrics:\n%s", metrics)
|
||||
}
|
||||
|
||||
// Closed, the endpoint refuses the connection made to send the
|
||||
// lines still waiting at the stop, which then does not wait.
|
||||
_ = endpoint.Close()
|
||||
// From here the endpoint closes each connection it takes, so the
|
||||
// one made to send the lines still waiting at the stop fails at
|
||||
// once. Closing the endpoint instead would free its port for
|
||||
// another test to take.
|
||||
go func() {
|
||||
for {
|
||||
conn, err := endpoint.Accept()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
_ = conn.Close()
|
||||
}
|
||||
}()
|
||||
})
|
||||
|
||||
out.line(t, "type", "request")
|
||||
|
||||
Reference in new issue
Block a user