Skip to content

Commit

Permalink
Merge 4782b32 into 5733cd6
Browse files Browse the repository at this point in the history
  • Loading branch information
gerzse authored Mar 13, 2024
2 parents 5733cd6 + 4782b32 commit 18e6158
Show file tree
Hide file tree
Showing 12 changed files with 1,448 additions and 1,354 deletions.
57 changes: 57 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,50 @@ cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node5.conf
endef

# STABLE CLUSTER REDIS NODES
# The structure of this cluster is not changed by the tests!
define REDIS_STABLE_CLUSTER_NODE1_CONF
daemonize yes
protected-mode no
requirepass cluster
port 7479
cluster-node-timeout 15000
pidfile /tmp/redis_stable_cluster_node1.pid
logfile /tmp/redis_stable_cluster_node1.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_stable_cluster_node1.conf
endef

define REDIS_STABLE_CLUSTER_NODE2_CONF
daemonize yes
protected-mode no
requirepass cluster
port 7480
cluster-node-timeout 15000
pidfile /tmp/redis_stable_cluster_node2.pid
logfile /tmp/redis_stable_cluster_node2.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_stable_cluster_node2.conf
endef

define REDIS_STABLE_CLUSTER_NODE3_CONF
daemonize yes
protected-mode no
requirepass cluster
port 7481
cluster-node-timeout 15000
pidfile /tmp/redis_stable_cluster_node3.pid
logfile /tmp/redis_stable_cluster_node3.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_stable_cluster_node3.conf
endef

# UDS REDIS NODES
define REDIS_UDS
daemonize yes
Expand Down Expand Up @@ -355,6 +399,9 @@ export REDIS_CLUSTER_NODE2_CONF
export REDIS_CLUSTER_NODE3_CONF
export REDIS_CLUSTER_NODE4_CONF
export REDIS_CLUSTER_NODE5_CONF
export REDIS_STABLE_CLUSTER_NODE1_CONF
export REDIS_STABLE_CLUSTER_NODE2_CONF
export REDIS_STABLE_CLUSTER_NODE3_CONF
export REDIS_UDS
export REDIS_UNAVAILABLE_CONF
export STUNNEL_CONF
Expand Down Expand Up @@ -393,8 +440,12 @@ start: stunnel cleanup
echo "$$REDIS_CLUSTER_NODE3_CONF" | redis-server -
echo "$$REDIS_CLUSTER_NODE4_CONF" | redis-server -
echo "$$REDIS_CLUSTER_NODE5_CONF" | redis-server -
echo "$$REDIS_STABLE_CLUSTER_NODE1_CONF" | redis-server -
echo "$$REDIS_STABLE_CLUSTER_NODE2_CONF" | redis-server -
echo "$$REDIS_STABLE_CLUSTER_NODE3_CONF" | redis-server -
echo "$$REDIS_UDS" | redis-server -
echo "$$REDIS_UNAVAILABLE_CONF" | redis-server -
redis-cli -a cluster --cluster create 127.0.0.1:7479 127.0.0.1:7480 127.0.0.1:7481 --cluster-yes

cleanup:
- rm -vf /tmp/redis_cluster_node*.conf 2>/dev/null
Expand Down Expand Up @@ -426,6 +477,9 @@ stop:
kill `cat /tmp/redis_cluster_node3.pid` || true
kill `cat /tmp/redis_cluster_node4.pid` || true
kill `cat /tmp/redis_cluster_node5.pid` || true
kill `cat /tmp/redis_stable_cluster_node1.pid`
kill `cat /tmp/redis_stable_cluster_node2.pid`
kill `cat /tmp/redis_stable_cluster_node3.pid`
kill `cat /tmp/redis_uds.pid` || true
kill `cat /tmp/stunnel.pid` || true
[ -f /tmp/redis_unavailable.pid ] && kill `cat /tmp/redis_unavailable.pid` || true
Expand All @@ -439,6 +493,9 @@ stop:
rm -f /tmp/redis_cluster_node3.conf
rm -f /tmp/redis_cluster_node4.conf
rm -f /tmp/redis_cluster_node5.conf
rm -f /tmp/redis_stable_cluster_node1.conf
rm -f /tmp/redis_stable_cluster_node2.conf
rm -f /tmp/redis_stable_cluster_node3.conf

test: compile-module start
sleep 2
Expand Down
9 changes: 9 additions & 0 deletions src/test/java/redis/clients/jedis/HostAndPorts.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public final class HostAndPorts {
private static List<HostAndPort> redisHostAndPortList = new ArrayList<>();
private static List<HostAndPort> sentinelHostAndPortList = new ArrayList<>();
private static List<HostAndPort> clusterHostAndPortList = new ArrayList<>();
private static List<HostAndPort> stableClusterHostAndPortList = new ArrayList<>();

static {
redisHostAndPortList.add(new HostAndPort("localhost", Protocol.DEFAULT_PORT));
Expand All @@ -34,6 +35,10 @@ public final class HostAndPorts {
clusterHostAndPortList.add(new HostAndPort("localhost", 7382));
clusterHostAndPortList.add(new HostAndPort("localhost", 7383));
clusterHostAndPortList.add(new HostAndPort("localhost", 7384));

stableClusterHostAndPortList.add(new HostAndPort("localhost", 7479));
stableClusterHostAndPortList.add(new HostAndPort("localhost", 7480));
stableClusterHostAndPortList.add(new HostAndPort("localhost", 7481));
}

public static List<HostAndPort> parseHosts(String envHosts,
Expand Down Expand Up @@ -71,6 +76,10 @@ public static List<HostAndPort> getClusterServers() {
return clusterHostAndPortList;
}

public static List<HostAndPort> getStableClusterServers() {
return stableClusterHostAndPortList;
}

private HostAndPorts() {
throw new InstantiationError("Must not instantiate this class");
}
Expand Down
Loading

0 comments on commit 18e6158

Please sign in to comment.