From c40bfa00b55112a9f42719c2226355f14059626e Mon Sep 17 00:00:00 2001 From: c00603587 Date: Fri, 20 Oct 2023 15:49:44 +0800 Subject: [PATCH] modify localhost to 127 Signed-off-by: c00603587 --- src/test/java/redis/clients/jedis/HostAndPorts.java | 6 +++--- .../redis/clients/jedis/SentinelMasterListenerTest.java | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/test/java/redis/clients/jedis/HostAndPorts.java b/src/test/java/redis/clients/jedis/HostAndPorts.java index 1bda3dc085..d61a8bb3fb 100644 --- a/src/test/java/redis/clients/jedis/HostAndPorts.java +++ b/src/test/java/redis/clients/jedis/HostAndPorts.java @@ -21,15 +21,15 @@ public final class HostAndPorts { redisHostAndPortList.add(new HostAndPort("localhost", Protocol.DEFAULT_PORT + 8)); redisHostAndPortList.add(new HostAndPort("localhost", Protocol.DEFAULT_PORT + 9)); redisHostAndPortList.add(new HostAndPort("localhost", Protocol.DEFAULT_PORT + 10)); - redisHostAndPortList.add(new HostAndPort("localhost", Protocol.DEFAULT_PORT + 11)); - redisHostAndPortList.add(new HostAndPort("localhost", Protocol.DEFAULT_PORT + 12)); + redisHostAndPortList.add(new HostAndPort("127.0.0.1", Protocol.DEFAULT_PORT + 11)); + redisHostAndPortList.add(new HostAndPort("127.0.0.1", Protocol.DEFAULT_PORT + 12)); sentinelHostAndPortList.add(new HostAndPort("localhost", Protocol.DEFAULT_SENTINEL_PORT)); sentinelHostAndPortList.add(new HostAndPort("localhost", Protocol.DEFAULT_SENTINEL_PORT + 1)); sentinelHostAndPortList.add(new HostAndPort("localhost", Protocol.DEFAULT_SENTINEL_PORT + 2)); sentinelHostAndPortList.add(new HostAndPort("localhost", Protocol.DEFAULT_SENTINEL_PORT + 3)); sentinelHostAndPortList.add(new HostAndPort("localhost", Protocol.DEFAULT_SENTINEL_PORT + 4)); - sentinelHostAndPortList.add(new HostAndPort("localhost", Protocol.DEFAULT_SENTINEL_PORT + 5)); + sentinelHostAndPortList.add(new HostAndPort("127.0.0.1", Protocol.DEFAULT_SENTINEL_PORT + 5)); clusterHostAndPortList.add(new HostAndPort("localhost", 7379)); clusterHostAndPortList.add(new HostAndPort("localhost", 7380)); diff --git a/src/test/java/redis/clients/jedis/SentinelMasterListenerTest.java b/src/test/java/redis/clients/jedis/SentinelMasterListenerTest.java index b1cb10b833..2e36ee2bb6 100644 --- a/src/test/java/redis/clients/jedis/SentinelMasterListenerTest.java +++ b/src/test/java/redis/clients/jedis/SentinelMasterListenerTest.java @@ -35,13 +35,12 @@ public void failover() throws InterruptedException { try { HostAndPort masterGetFromPoolBefore = pool.getResource().connection.getHostAndPort(); - sentinel.sendCommand(Protocol.Command.SENTINEL, "failover", FAILOVER_MASTER_NAME); + sentinel.sentinelFailover(FAILOVER_MASTER_NAME); // more than 5seconds ensure fail over be detect Thread.sleep(10000); HostAndPort masterGetFromPoolCurrent = pool.getResource().connection.getHostAndPort(); - assertNotEquals(masterGetFromPoolBefore, masterGetFromPoolCurrent); } finally { sentinel.close();