Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
thachlp committed Sep 12, 2024
1 parent af62250 commit bb87e40
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bb87e40

Please sign in to comment.