Skip to content

Commit

Permalink
fix pipelining test
Browse files Browse the repository at this point in the history
untilasserted
  • Loading branch information
atakavci committed Oct 15, 2024
1 parent ef8d4a0 commit 5cb7b30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/test/java/redis/clients/jedis/PipeliningTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.awaitility.Awaitility;

import redis.clients.jedis.commands.ProtocolCommand;
import redis.clients.jedis.commands.jedis.JedisCommandsTestBase;
Expand Down Expand Up @@ -342,7 +344,8 @@ public void waitAof() {

try (Jedis j = new Jedis(endpoint.getHostAndPort())) {
j.auth(endpoint.getPassword());
assertEquals("aof", j.get("wait"));
Awaitility.await().atMost(5, TimeUnit.SECONDS).pollInterval(50, TimeUnit.MILLISECONDS)
.untilAsserted(() -> assertEquals("aof", j.get("wait")));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertNull;
import static org.awaitility.Awaitility.await;

import java.util.Arrays;
Expand Down Expand Up @@ -41,7 +42,7 @@ public void simple() {
assertEquals("bar", jedis.get("foo"));
control.del("foo");
await().atMost(5, TimeUnit.SECONDS).pollInterval(50, TimeUnit.MILLISECONDS)
.until(() -> jedis.get("foo") == null);
.untilAsserted(() -> assertNull(jedis.get("foo")));
}
}

Expand All @@ -56,7 +57,7 @@ public void simpleWithSimpleMap() {
control.del("foo");
assertEquals(1, cache.getSize());
await().atMost(5, TimeUnit.SECONDS).pollInterval(50, TimeUnit.MILLISECONDS)
.until(() -> jedis.get("foo") == null);
.untilAsserted(() -> assertNull(jedis.get("foo")));
assertEquals(1, cache.getSize());
}
}
Expand All @@ -69,7 +70,7 @@ public void flushAll() {
assertEquals("bar", jedis.get("foo"));
control.flushAll();
await().atMost(5, TimeUnit.SECONDS).pollInterval(50, TimeUnit.MILLISECONDS)
.until(() -> jedis.get("foo") == null);
.untilAsserted(() -> assertNull(jedis.get("foo")));
}
}

Expand All @@ -84,7 +85,7 @@ public void flushAllWithSimpleMap() {
control.flushAll();
assertEquals(1, cache.getSize());
await().atMost(5, TimeUnit.SECONDS).pollInterval(50, TimeUnit.MILLISECONDS)
.until(() -> jedis.get("foo") == null);
.untilAsserted(() -> assertNull(jedis.get("foo")));
assertEquals(1, cache.getSize());
}
}
Expand Down

0 comments on commit 5cb7b30

Please sign in to comment.