Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
thachlp committed Dec 31, 2024
1 parent 34d1ae6 commit d8507a5
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -718,15 +718,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 d8507a5

Please sign in to comment.