make control command tests fast

This commit is contained in:
Jonathan Leibiusky
2013-12-03 17:54:35 -05:00
parent 58123034f5
commit ceac8123d6
2 changed files with 4 additions and 18 deletions

View File

@@ -2860,6 +2860,7 @@ public class BinaryJedis implements BasicCommands, BinaryJedisCommands, MultiKey
*/ */
public void monitor(final JedisMonitor jedisMonitor) { public void monitor(final JedisMonitor jedisMonitor) {
client.monitor(); client.monitor();
client.getStatusCodeReply();
jedisMonitor.proceed(client); jedisMonitor.proceed(client);
} }

View File

@@ -45,18 +45,8 @@ public class ControlCommandsTest extends JedisCommandTestBase {
@Test @Test
public void lastsave() throws InterruptedException { public void lastsave() throws InterruptedException {
long before = jedis.lastsave(); long saved = jedis.lastsave();
String st = ""; assertTrue(saved > 0);
while (!st.equals("OK")) {
try {
Thread.sleep(1000);
st = jedis.save();
} catch (JedisDataException e) {
}
}
long after = jedis.lastsave();
assertTrue((after - before) > 0);
} }
@Test @Test
@@ -73,14 +63,9 @@ public class ControlCommandsTest extends JedisCommandTestBase {
public void run() { public void run() {
Jedis j = new Jedis("localhost"); Jedis j = new Jedis("localhost");
j.auth("foobared"); j.auth("foobared");
for (int i = 0; i < 4; i++) { for (int i = 0; i < 5; i++) {
j.incr("foobared"); j.incr("foobared");
} }
try {
Thread.sleep(2500);
} catch (InterruptedException e) {
}
j.incr("foobared");
j.disconnect(); j.disconnect();
} }
}).start(); }).start();