Skip to content

Commit

Permalink
[FLINK-24584][qs] Improve assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
zentol committed Oct 19, 2021
1 parent f75cf38 commit 4749a77
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.nio.channels.ClosedChannelException;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -266,15 +267,10 @@ public void testRequestUnavailableHost() throws Exception {
new KvStateInternalRequest(new KvStateID(), new byte[0]);
CompletableFuture<KvStateResponse> future = client.sendRequest(serverAddress, request);

try {
future.get();
fail("Did not throw expected ConnectException");
} catch (ExecutionException e) {
if (!(e.getCause() instanceof ConnectException)) {
fail("Did not throw expected ConnectException");
}
// else expected
}
assertThat(
future,
FlinkMatchers.futureWillCompleteExceptionally(
ConnectException.class, Duration.ofHours(1)));
} finally {
if (client != null) {
try {
Expand Down

0 comments on commit 4749a77

Please sign in to comment.