diff --git a/core/src/test/java/com/linecorp/armeria/client/DefaultDnsCacheTest.java b/core/src/test/java/com/linecorp/armeria/client/DefaultDnsCacheTest.java index 4305ddde6d1..921ecd47db3 100644 --- a/core/src/test/java/com/linecorp/armeria/client/DefaultDnsCacheTest.java +++ b/core/src/test/java/com/linecorp/armeria/client/DefaultDnsCacheTest.java @@ -290,6 +290,10 @@ public void onEviction(DnsQuestion question, @Nullable List records, dnsCache.cache(query0, ImmutableList.of(record0)); // Exceeds the maximum size. The old cache, query0, should be removed. dnsCache.cache(query1, ImmutableList.of(record1)); + + // Perform a get operation to trigger the eviction. + dnsCache.get(query0); + dnsCache.get(query1); await().untilTrue(evicted); assertThat(removed).isFalse(); } diff --git a/core/src/test/java/com/linecorp/armeria/common/stream/StreamMessageCollectingTest.java b/core/src/test/java/com/linecorp/armeria/common/stream/StreamMessageCollectingTest.java index 983cf6e1b63..4259a178874 100644 --- a/core/src/test/java/com/linecorp/armeria/common/stream/StreamMessageCollectingTest.java +++ b/core/src/test/java/com/linecorp/armeria/common/stream/StreamMessageCollectingTest.java @@ -207,10 +207,11 @@ protected HttpData filter(HttpData obj) { .hasCauseInstanceOf(CancelledSubscriptionException.class); final List bufs = ImmutableList.copyOf(data.values()); - - for (ByteBuf buf : bufs) { - assertThat(buf.refCnt()).isZero(); - } + await().untilAsserted(() -> { + for (ByteBuf buf : bufs) { + assertThat(buf.refCnt()).isZero(); + } + }); } @Test diff --git a/core/src/test/java/com/linecorp/armeria/server/Http1ServerDelayedCloseConnectionTest.java b/core/src/test/java/com/linecorp/armeria/server/Http1ServerDelayedCloseConnectionTest.java index 40bbb8a1129..c077dc97d47 100644 --- a/core/src/test/java/com/linecorp/armeria/server/Http1ServerDelayedCloseConnectionTest.java +++ b/core/src/test/java/com/linecorp/armeria/server/Http1ServerDelayedCloseConnectionTest.java @@ -109,7 +109,9 @@ void shouldWaitForDisconnectByClientSideFirst() throws IOException { assertThat(in.readLine()).isEmpty(); assertThat(in.readLine()).isEqualToIgnoringCase("OK"); - assertThat(server.server().numConnections()).isEqualTo(1); + await().untilAsserted(() -> { + assertThat(server.server().numConnections()).isEqualTo(1); + }); socket.close(); assertThatThrownBy(