Skip to content

Commit

Permalink
Issue #5105 - fix GracefulStopTest expectations from 503s to 404s
Browse files Browse the repository at this point in the history
StatisticsHandler no longer gives 503 responses after shutdown.

Signed-off-by: Lachlan Roberts <[email protected]>
  • Loading branch information
lachlan-roberts committed Aug 19, 2020
1 parent a65f001 commit 0fae221
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public void run()
).getBytes());
client2.getOutputStream().flush();
String response2 = IO.toString(client2.getInputStream());
assertThat(response2, containsString(" 503 "));
assertThat(response2, containsString(" 404 "));

now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
Thread.sleep(Math.max(1, end - now));
Expand All @@ -330,8 +330,9 @@ public void run()
assertThat(response, containsString(" 200 OK"));
assertThat(response, containsString("read 10/10"));

assertThat(stats.getRequests(), is(2));
assertThat(stats.getResponses5xx(), is(1));
// The StatisticsHandler was shutdown when it received the second request so does not contribute to the stats.
assertThat(stats.getRequests(), is(1));
assertThat(stats.getResponses4xx(), is(0));
}
}

Expand Down Expand Up @@ -631,7 +632,7 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques

// Check new connections rejected!
String unavailable = connector.getResponse("GET / HTTP/1.1\r\nHost:localhost\r\n\r\n");
assertThat(unavailable, containsString(" 503 Service Unavailable"));
assertThat(unavailable, containsString(" 404 Not Found"));
assertThat(unavailable, Matchers.containsString("Connection: close"));

// Check completed 200 has close
Expand Down

0 comments on commit 0fae221

Please sign in to comment.