From fddd41d7960777338fd125edab9c46f668a9d654 Mon Sep 17 00:00:00 2001 From: Jonathan Leibiusky Date: Mon, 2 Sep 2013 18:13:14 -0300 Subject: [PATCH] change makefile to accept "start" and "stop" to be able to start the testing environment and stopping it for manual testing purposes. raising down-after-milliseconds of sentinel 1 to avoid taking the master down and up all the time. change sleep to 10 seconds after doing a "salveof" to avoid false negatives. --- Makefile | 21 ++++++++++++++++++- .../jedis/tests/JedisSentinelTest.java | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 56f1910..6845923 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ port 26379 daemonize yes sentinel monitor mymaster 127.0.0.1 6379 1 sentinel auth-pass mymaster foobared -sentinel down-after-milliseconds mymaster 1000 +sentinel down-after-milliseconds mymaster 3000 sentinel failover-timeout mymaster 900000 sentinel can-failover mymaster yes sentinel parallel-syncs mymaster 1 @@ -73,6 +73,25 @@ export REDIS_SENTINEL1 export REDIS_SENTINEL2 export REDIS_SENTINEL3 +start: + echo "$$REDIS1_CONF" | redis-server - + echo "$$REDIS2_CONF" | redis-server - + echo "$$REDIS3_CONF" | redis-server - + echo "$$REDIS4_CONF" | redis-server - + echo "$$REDIS_SENTINEL1" | redis-sentinel - + echo "$$REDIS_SENTINEL2" | redis-sentinel - + echo "$$REDIS_SENTINEL3" | redis-sentinel - + +stop: + kill `cat /tmp/redis1.pid` + kill `cat /tmp/redis2.pid` + # this get's segfaulted by the tests + kill `cat /tmp/redis3.pid` || true + kill `cat /tmp/redis4.pid` + kill `cat /tmp/sentinel1.pid` + kill `cat /tmp/sentinel2.pid` + kill `cat /tmp/sentinel3.pid` + test: echo "$$REDIS1_CONF" | redis-server - echo "$$REDIS2_CONF" | redis-server - diff --git a/src/test/java/redis/clients/jedis/tests/JedisSentinelTest.java b/src/test/java/redis/clients/jedis/tests/JedisSentinelTest.java index a3dc68a..868527f 100644 --- a/src/test/java/redis/clients/jedis/tests/JedisSentinelTest.java +++ b/src/test/java/redis/clients/jedis/tests/JedisSentinelTest.java @@ -25,7 +25,7 @@ public class JedisSentinelTest { // TODO: The sleep is to give time to the slave to synchronize with the // master and also let know the sentinels about this new topology. We // should find a better way to do this. - Thread.sleep(5000); + Thread.sleep(10000); } @After