Skip to content

Commit

Permalink
Add colors to the log, make integration tests failures also fail the …
Browse files Browse the repository at this point in the history
…build, disable shard pubsub test that fails
  • Loading branch information
tishun committed Apr 11, 2024
1 parent fc76545 commit 987777b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,11 @@ stop:
pkill redis-sentinel && sleep 1 || true

test-coverage: start
mvn -B -DskipITs=false clean compile verify jacoco:report -P$(PROFILE)
mvn -DskipITs=false clean compile verify jacoco:report -P$(PROFILE)
$(MAKE) stop

test: start
mvn -B -DskipITs=false clean compile verify -P$(PROFILE)
mvn -DskipITs=false clean compile verify -P$(PROFILE)
$(MAKE) stop

prepare: stop
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import javax.inject.Inject;

import org.junit.Ignore;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -62,8 +63,6 @@ class RedisClusterPubSubConnectionIntegrationTests extends TestSupport {

String shardChannel = "shard-channel";

String shardTestChannel = "shard-test-channel";

@Inject
RedisClusterPubSubConnectionIntegrationTests(RedisClusterClient clusterClient) {
this.clusterClient = clusterClient;
Expand Down Expand Up @@ -101,15 +100,14 @@ void testRegularClientPubSubChannels() {
}

@Test
@EnabledOnCommand("SSUBSCRIBE")
void testRegularClientPubSubShardChannels() {

String nodeId = pubSubConnection.sync().clusterMyId();
RedisClusterNode otherNode = getOtherThan(nodeId);
/// TODO : uncomment after SSUBSCRIBE is implemented
// pubSubConnection.sync().ssubscribe(key);
pubSubConnection.sync().ssubscribe(key);

List<String> channelsOnSubscribedNode = connection.getConnection(nodeId).sync().pubsubShardChannels();
// assertThat(channelsOnSubscribedNode).hasSize(1);
assertThat(channelsOnSubscribedNode).hasSize(1);

List<String> channelsOnOtherNode = connection.getConnection(otherNode.getNodeId()).sync().pubsubShardChannels();
assertThat(channelsOnOtherNode).isEmpty();
Expand All @@ -123,6 +121,13 @@ void subscribeToShardChannel() throws Exception {
Wait.untilTrue(() -> shardChannel.equals(connectionListener.getChannels().poll())).waitOrTimeout();
}

@Ignore
// This test is currently failing because the replica of the master node, where we subscribe to a shard channel,
// could be used to SPUBLISH to this channel, but does not list the shard channels with PUBSUB SHARDCHANNELS or
// PUBSUB SHARDNUMSUB

// furthermore the test does not address the possibility that the SSUBSCRIBE could result in a MOVED, e.g. when
// the hash of the shard channel name would have to be hosted on another node
@Test
@EnabledOnCommand("SSUBSCRIBE")
void subscribeToShardChannelViaOtherEndpoint() throws Exception {
Expand All @@ -132,7 +137,7 @@ void subscribeToShardChannelViaOtherEndpoint() throws Exception {
RedisPubSubAsyncCommands<String, String> other = pubSub
.nodes(node -> node.getRole().isUpstream() && !node.getNodeId().equals(nodeId)).commands(0);
other.ssubscribe(shardChannel);
Wait.untilTrue(() -> shardChannel.equals(connectionListener.getChannels().poll())).waitOrTimeout();
assertThat(connectionListener.getChannels().poll(3, TimeUnit.SECONDS)).isEqualTo(shardChannel);
}

@Test
Expand Down

0 comments on commit 987777b

Please sign in to comment.