From 642cec66d5d833490bc7b17adbdfa37e46a2c676 Mon Sep 17 00:00:00 2001 From: Jungtaek Lim Date: Mon, 27 Jan 2014 12:47:21 +0900 Subject: [PATCH] Fix ControlCommandsTest to don't hang from monitor test because of timing issue * In monitor command test, input thread waits for monitor thread to monitor ** Monitor command test sometimes hang when input thread run earlier than monitor thread. --- .../clients/jedis/tests/commands/ControlCommandsTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test/java/redis/clients/jedis/tests/commands/ControlCommandsTest.java b/src/test/java/redis/clients/jedis/tests/commands/ControlCommandsTest.java index 832cd6c..bba56c1 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/ControlCommandsTest.java +++ b/src/test/java/redis/clients/jedis/tests/commands/ControlCommandsTest.java @@ -61,6 +61,11 @@ public class ControlCommandsTest extends JedisCommandTestBase { public void monitor() { new Thread(new Runnable() { public void run() { + try { + // sleep 100ms to make sure that monitor thread runs first + Thread.sleep(100); + } catch (InterruptedException e) { + } Jedis j = new Jedis("localhost"); j.auth("foobared"); for (int i = 0; i < 5; i++) {