Fix sentinel test not to be so sensitive to time
This commit is contained in:
1
Makefile
1
Makefile
@@ -188,6 +188,7 @@ stop:
|
||||
|
||||
test:
|
||||
make start
|
||||
sleep 2
|
||||
mvn -Dtest=${TEST} clean compile test
|
||||
make stop
|
||||
|
||||
|
||||
@@ -66,11 +66,9 @@ public class JedisClusterTest extends Assert {
|
||||
pipeline2.sync();
|
||||
pipeline3.sync();
|
||||
|
||||
|
||||
waitForClusterReady();
|
||||
}
|
||||
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
// clear all slots
|
||||
@@ -94,7 +92,9 @@ public class JedisClusterTest extends Assert {
|
||||
node1.set("foo", "bar");
|
||||
} catch (JedisMovedDataException jme) {
|
||||
assertEquals(12182, jme.getSlot());
|
||||
assertEquals(new HostAndPort("127.0.0.1", 7381), jme.getTargetNode());
|
||||
assertEquals(new HostAndPort("127.0.0.1", 7381),
|
||||
jme.getTargetNode());
|
||||
return;
|
||||
}
|
||||
fail();
|
||||
}
|
||||
@@ -184,9 +184,9 @@ public class JedisClusterTest extends Assert {
|
||||
private void waitForClusterReady() throws InterruptedException {
|
||||
boolean clusterOk = false;
|
||||
while (!clusterOk) {
|
||||
if (node1.clusterInfo().split("\n")[0].contains("ok") &&
|
||||
node2.clusterInfo().split("\n")[0].contains("ok") &&
|
||||
node3.clusterInfo().split("\n")[0].contains("ok") ) {
|
||||
if (node1.clusterInfo().split("\n")[0].contains("ok")
|
||||
&& node2.clusterInfo().split("\n")[0].contains("ok")
|
||||
&& node3.clusterInfo().split("\n")[0].contains("ok")) {
|
||||
clusterOk = true;
|
||||
}
|
||||
Thread.sleep(50);
|
||||
|
||||
@@ -69,6 +69,7 @@ public class JedisSentinelPoolTest extends JedisTestBase {
|
||||
}
|
||||
|
||||
waitForFailover(pool, oldMaster);
|
||||
Thread.sleep(100);
|
||||
|
||||
jedis = pool.getResource();
|
||||
assertEquals("PONG", jedis.ping());
|
||||
|
||||
Reference in New Issue
Block a user