From d2b46ba188e47d2c847f5661df5820221adebbf2 Mon Sep 17 00:00:00 2001 From: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> Date: Wed, 10 Nov 2021 11:29:59 +0600 Subject: [PATCH] Address effects on CLIENT PAUSE due to changes in Redis unstable --- .../jedis/tests/commands/ControlCommandsTest.java | 14 +++++++------- .../tests/commands/JedisCommandsTestBase.java | 4 ++++ 2 files changed, 11 insertions(+), 7 deletions(-) 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 7c4ebeec5d..089df82311 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/ControlCommandsTest.java +++ b/src/test/java/redis/clients/jedis/tests/commands/ControlCommandsTest.java @@ -223,10 +223,10 @@ public void waitReplicas() { public void clientPause() throws InterruptedException, ExecutionException { ExecutorService executorService = Executors.newFixedThreadPool(2); try { - final Jedis jedisToPause1 = createJedis(); - final Jedis jedisToPause2 = createJedis(); + final Jedis jedisToPause1 = createJedisDefaultTimeout(); + final Jedis jedisToPause2 = createJedisDefaultTimeout(); - int pauseMillis = 1250; + int pauseMillis = 600; jedis.clientPause(pauseMillis); Future latency1 = executorService.submit(new Callable() { @@ -265,11 +265,11 @@ public Long call() throws Exception { @Test public void clientPauseAll() throws InterruptedException, ExecutionException { - final int pauseMillis = 1250; + final int pauseMillis = 600; final int pauseMillisDelta = 100; ExecutorService executorService = Executors.newFixedThreadPool(1); - try (Jedis jedisPause = createJedis()) { + try (Jedis jedisPause = createJedisDefaultTimeout();) { jedis.clientPause(pauseMillis, ClientPauseMode.ALL); @@ -295,11 +295,11 @@ public Long call() throws Exception { @Test public void clientPauseWrite() throws InterruptedException, ExecutionException { - final int pauseMillis = 1250; + final int pauseMillis = 600; final int pauseMillisDelta = 100; ExecutorService executorService = Executors.newFixedThreadPool(2); - try (Jedis jedisRead = createJedis(); Jedis jedisWrite = createJedis();) { + try (Jedis jedisRead = createJedisDefaultTimeout(); Jedis jedisWrite = createJedisDefaultTimeout();) { jedis.clientPause(pauseMillis, ClientPauseMode.WRITE); diff --git a/src/test/java/redis/clients/jedis/tests/commands/JedisCommandsTestBase.java b/src/test/java/redis/clients/jedis/tests/commands/JedisCommandsTestBase.java index c769c4c733..95b05e8241 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/JedisCommandsTestBase.java +++ b/src/test/java/redis/clients/jedis/tests/commands/JedisCommandsTestBase.java @@ -36,4 +36,8 @@ public void tearDown() throws Exception { protected Jedis createJedis() { return new Jedis(hnp, config); } + + protected Jedis createJedisDefaultTimeout() { + return new Jedis(hnp, DefaultJedisClientConfig.builder().password("foobared").build()); + } }