From bb87e40080e4acb67237c7c6b410c208a8a670ea Mon Sep 17 00:00:00 2001 From: Thach Le <thach.le@linecorp.com> Date: Thu, 12 Sep 2024 13:17:45 +0700 Subject: [PATCH] Update test --- .../core/cluster/RedisClusterClientIntegrationTests.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/java/io/lettuce/core/cluster/RedisClusterClientIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/RedisClusterClientIntegrationTests.java index 9b6e7a58ed..9db882af0b 100644 --- a/src/test/java/io/lettuce/core/cluster/RedisClusterClientIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/RedisClusterClientIntegrationTests.java @@ -715,15 +715,17 @@ public void clear() { @Test void shouldCancelTopologyRefreshTaskOnShutdown() { ClusterTopologyRefreshOptions refreshOptions = ClusterTopologyRefreshOptions.builder() - .enablePeriodicRefresh(Duration.ofSeconds(1)).build(); + .enablePeriodicRefresh(Duration.ofMillis(200)).build(); RedisClusterClient clusterClient = RedisClusterClient.create(TestClientResources.get(), RedisURI.Builder.redis(TestSettings.host(), ClusterTestSettings.port1).build()); + clusterClient.setOptions(ClusterClientOptions.builder().topologyRefreshOptions(refreshOptions).build()); clusterClient.connect().sync(); Delay.delay(Duration.ofMillis(1500)); - assertThat(clusterClient.isTopologyRefreshInProgress()).isTrue(); + Wait.untilTrue(clusterClient::isTopologyRefreshInProgress).during(Duration.ofSeconds(5)).waitOrTimeout(); clusterClient.shutdownAsync(0, 10, TimeUnit.SECONDS).join(); + Wait.untilTrue(() -> !clusterClient.isTopologyRefreshInProgress()).during(Duration.ofSeconds(5)).waitOrTimeout(); assertThat(clusterClient.isTopologyRefreshInProgress()).isFalse(); FastShutdown.shutdown(clusterClient);