Skip to content

Commit

Permalink
Attempt to make the subscribeToShardChannelViaOtherEndpointa and pubS…
Browse files Browse the repository at this point in the history
…ubSsl more stable
  • Loading branch information
tishun committed Apr 11, 2024
1 parent 764fdf3 commit c4623b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/test/java/io/lettuce/core/SslIntegrationTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -383,14 +383,13 @@ void pubSubSsl() {
RedisPubSubCommands<String, String> connection = redisClient.connectPubSub(URI_NO_VERIFY).sync();
connection.subscribe("c1");
connection.subscribe("c2");
Delay.delay(Duration.ofMillis(200));

RedisPubSubCommands<String, String> connection2 = redisClient.connectPubSub(URI_NO_VERIFY).sync();

assertThat(connection2.pubsubChannels()).contains("c1", "c2");
Wait.untilTrue(()->connection2.pubsubChannels().contains("c1")).waitOrTimeout();
Wait.untilTrue(()->connection2.pubsubChannels().contains("c2")).waitOrTimeout();
connection.quit();
Delay.delay(Duration.ofMillis(200));
Wait.untilTrue(connection::isOpen).waitOrTimeout();
Wait.untilTrue(connection.getStatefulConnection()::isOpen).waitOrTimeout();
Wait.untilEquals(2, () -> connection2.pubsubChannels().size()).waitOrTimeout();

assertThat(connection2.pubsubChannels()).contains("c1", "c2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void testRegularClientPubSubShardChannels() {
void subscribeToShardChannel() throws Exception {
pubSubConnection.addListener(connectionListener);
pubSubConnection.async().ssubscribe(shardChannel);
assertThat(connectionListener.getChannels().poll(3, TimeUnit.SECONDS)).isEqualTo(shardChannel);
assertThat(connectionListener.getChannels().take()).isEqualTo(shardChannel);
}

@Test
Expand All @@ -132,7 +132,7 @@ void subscribeToShardChannelViaOtherEndpoint() throws Exception {
RedisPubSubAsyncCommands<String, String> other = pubSub
.nodes(node -> node.getRole().isUpstream() && !node.getNodeId().equals(nodeId)).commands(0);
other.ssubscribe(shardChannel);
assertThat(connectionListener.getChannels().poll(3, TimeUnit.SECONDS)).isEqualTo(shardChannel);
assertThat(connectionListener.getChannels().take()).isEqualTo(shardChannel);
}

@Test
Expand Down

0 comments on commit c4623b0

Please sign in to comment.