Bad tests take too long
This commit is contained in:
parent
35b94fffd3
commit
25a95b83f9
|
@ -92,7 +92,8 @@ public abstract class AbstractHttpTest
|
|||
writer.write("\r\n");
|
||||
writer.flush();
|
||||
|
||||
HttpTester.Response response = HttpTester.parseResponse(socket.getInputStream());
|
||||
HttpTester.Input input = HttpTester.from(socket.getInputStream());
|
||||
HttpTester.Response response = HttpTester.parseResponse(input);
|
||||
if ("HTTP/1.1".equals(httpVersion)
|
||||
&& response.get("content-length") == null
|
||||
&& response.get("transfer-encoding") == null
|
||||
|
|
|
@ -417,6 +417,47 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetContentLengthFlushAndWriteInsufficientBytes() throws Exception
|
||||
{
|
||||
server.setHandler(new SetContentLengthAndWriteInsufficientBytesHandler(true));
|
||||
server.start();
|
||||
try
|
||||
{
|
||||
HttpTester.Response response = executeRequest();
|
||||
char badChar = (char) -1;
|
||||
String failed_body = "" + badChar + badChar + badChar;
|
||||
assertThat("response code", response.getStatus(), is(200));
|
||||
assertHeader(response, "content-length", "6");
|
||||
assertThat(response.getContent(), endsWith(failed_body));
|
||||
}
|
||||
catch(EOFException e)
|
||||
{
|
||||
// possible good response
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetContentLengthAndWriteInsufficientBytes() throws Exception
|
||||
{
|
||||
server.setHandler(new SetContentLengthAndWriteInsufficientBytesHandler(false));
|
||||
server.start();
|
||||
|
||||
try
|
||||
{
|
||||
HttpTester.Response response = executeRequest();
|
||||
char badChar = (char) -1;
|
||||
String failed_body = "" + badChar + badChar + badChar;
|
||||
assertThat("response code is 200", response.getStatus(), is(200));
|
||||
assertHeader(response, "content-length", "6");
|
||||
assertThat(response.getContent(), endsWith(failed_body));
|
||||
}
|
||||
catch(EOFException e)
|
||||
{
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetContentLengthAndWriteExactlyThatAmountOfBytes() throws Exception
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue