Fix sentinel test not to be so sensitive to time

This commit is contained in:
Jonathan Leibiusky
2014-01-16 20:37:47 -05:00
parent 424ae75c7d
commit 23b54c2cef
3 changed files with 136 additions and 134 deletions

View File

@@ -188,6 +188,7 @@ stop:
test:
make start
sleep 2
mvn -Dtest=${TEST} clean compile test
make stop

View File

@@ -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);

View File

@@ -69,6 +69,7 @@ public class JedisSentinelPoolTest extends JedisTestBase {
}
waitForFailover(pool, oldMaster);
Thread.sleep(100);
jedis = pool.getResource();
assertEquals("PONG", jedis.ping());