Fixed flaky test EventsHandlerTest.testEventsOfNoopHandler().

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2024-09-06 11:58:45 +02:00
parent 6887435773
commit 5bff971fb0
No known key found for this signature in database
GPG Key ID: 1677D141BCF3584D
2 changed files with 5 additions and 11 deletions

View File

@ -111,7 +111,7 @@ public class EventsHandlerTest
String response = connector.getResponse(rawRequest);
assertThat(response, containsString("HTTP/1.1 200 OK"));
await().atMost(3, TimeUnit.SECONDS).until(attribute::get, is("testModifyRequestAttributes-123"));
await().atMost(5, TimeUnit.SECONDS).until(attribute::get, is("testModifyRequestAttributes-123"));
}
@Test
@ -233,6 +233,8 @@ public class EventsHandlerTest
String response = connector.getResponse(rawRequest);
assertThat(response, containsString("HTTP/1.1 200 OK"));
assertThat(events, equalTo(Arrays.asList("onBeforeHandling", "onAfterHandling", "onResponseBegin", "onComplete")));
await().atMost(5, TimeUnit.SECONDS).untilAsserted(() ->
assertThat(events, equalTo(Arrays.asList("onBeforeHandling", "onAfterHandling", "onResponseBegin", "onComplete"))
));
}
}

View File

@ -198,7 +198,7 @@ public class EventsHandlerTest extends AbstractTest
assertThat(response.getStatus(), is(200));
assertThat(response.getContentAsString(), is("ABCDEF"));
assertThat(stringBuffer.toString(), is("ABCDEF"));
assertThat(failures.size(), is(0));
await().atMost(5, TimeUnit.SECONDS).during(1, TimeUnit.SECONDS).until(failures::size, is(0));
}
@ParameterizedTest
@ -394,56 +394,48 @@ public class EventsHandlerTest extends AbstractTest
@Override
protected void onBeforeHandling(Request request)
{
// System.out.println("onBeforeHandling");
useForbiddenMethods(request, exceptions);
}
@Override
protected void onRequestRead(Request request, Content.Chunk chunk)
{
// System.out.println("onRequestRead " + chunk);
useForbiddenMethods(request, exceptions);
}
@Override
protected void onAfterHandling(Request request, boolean handled, Throwable failure)
{
// System.out.println("onAfterHandling");
useForbiddenMethods(request, exceptions);
}
@Override
protected void onResponseBegin(Request request, int status, HttpFields headers)
{
// System.out.println("onResponseBegin");
useForbiddenMethods(request, exceptions);
}
@Override
protected void onResponseWrite(Request request, boolean last, ByteBuffer content)
{
// System.out.println("onResponseWrite");
useForbiddenMethods(request, exceptions);
}
@Override
protected void onResponseWriteComplete(Request request, Throwable failure)
{
// System.out.println("onResponseWriteComplete");
useForbiddenMethods(request, exceptions);
}
@Override
protected void onResponseTrailersComplete(Request request, HttpFields trailers)
{
// System.out.println("onResponseTrailersComplete");
useForbiddenMethods(request, exceptions);
}
@Override
protected void onComplete(Request request, int status, HttpFields headers, Throwable failure)
{
// System.out.println("onComplete");
useForbiddenMethods(request, exceptions);
}