TESTS: Explicitly Fail Http Client Timeouts (#32708)
* Don't quietly ignore timeouts when waiting for HTTP responses * Fixes #32702
This commit is contained in:
parent
781e6ad551
commit
7d641ba69b
|
@ -58,6 +58,7 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import static io.netty.handler.codec.http.HttpHeaderNames.HOST;
|
||||
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* Tiny helper to send http requests over netty.
|
||||
|
@ -145,7 +146,9 @@ class Netty4HttpClient implements Closeable {
|
|||
for (HttpRequest request : requests) {
|
||||
channelFuture.channel().writeAndFlush(request);
|
||||
}
|
||||
latch.await(30, TimeUnit.SECONDS);
|
||||
if (latch.await(30L, TimeUnit.SECONDS) == false) {
|
||||
fail("Failed to get all expected responses.");
|
||||
}
|
||||
|
||||
} finally {
|
||||
if (channelFuture != null) {
|
||||
|
|
|
@ -71,6 +71,7 @@ import java.util.function.Consumer;
|
|||
import static io.netty.handler.codec.http.HttpHeaderNames.HOST;
|
||||
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
|
||||
import static org.elasticsearch.common.util.concurrent.EsExecutors.daemonThreadFactory;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* Tiny helper to send http requests over nio.
|
||||
|
@ -136,7 +137,9 @@ class NioHttpClient implements Closeable {
|
|||
for (HttpRequest request : requests) {
|
||||
nioSocketChannel.getContext().sendMessage(request, (v, e) -> {});
|
||||
}
|
||||
latch.await(30, TimeUnit.SECONDS);
|
||||
if (latch.await(30L, TimeUnit.SECONDS) == false) {
|
||||
fail("Failed to get all expected responses.");
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
|
|
Loading…
Reference in New Issue