Skip to content

Commit

Permalink
Make ClusterPipeliningTest faster (#3465)
Browse files Browse the repository at this point in the history
  • Loading branch information
sazzad16 authored Jun 13, 2023
1 parent 3cf1e40 commit f9a8575
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions src/test/java/redis/clients/jedis/ClusterPipeliningTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import redis.clients.jedis.args.*;
Expand All @@ -23,8 +24,6 @@
import redis.clients.jedis.util.JedisClusterTestUtil;
import redis.clients.jedis.util.SafeEncoder;

// SLOW
// TODO: make it fast
public class ClusterPipeliningTest {

private static final String LOCAL_IP = "127.0.0.1";
Expand All @@ -36,13 +35,13 @@ public class ClusterPipeliningTest {
private static Jedis node2;
private static Jedis node3;

private HostAndPort nodeInfo1 = HostAndPorts.getClusterServers().get(0);
private HostAndPort nodeInfo2 = HostAndPorts.getClusterServers().get(1);
private HostAndPort nodeInfo3 = HostAndPorts.getClusterServers().get(2);
private static HostAndPort nodeInfo1 = HostAndPorts.getClusterServers().get(0);
private static HostAndPort nodeInfo2 = HostAndPorts.getClusterServers().get(1);
private static HostAndPort nodeInfo3 = HostAndPorts.getClusterServers().get(2);
private Set<HostAndPort> nodes = new HashSet<>(Arrays.asList(nodeInfo1, nodeInfo2, nodeInfo3));

@Before
public void setUp() throws InterruptedException {
@BeforeClass
public static void setUp() throws InterruptedException {
node1 = new Jedis(nodeInfo1);
node1.auth("cluster");
node1.flushAll();
Expand Down Expand Up @@ -81,8 +80,22 @@ public void setUp() throws InterruptedException {
JedisClusterTestUtil.waitForClusterReady(node1, node2, node3);
}

@Before
public void prepare() {
node1.flushAll();
node2.flushAll();
node3.flushAll();
}

@After
public void cleanUp() {
node1.flushDB();
node2.flushDB();
node3.flushDB();
}

@AfterClass
public static void cleanUp() {
public static void tearDown() throws InterruptedException {
node1.flushDB();
node2.flushDB();
node3.flushDB();
Expand All @@ -91,11 +104,6 @@ public static void cleanUp() {
node3.clusterReset(ClusterResetType.SOFT);
}

@After
public void tearDown() throws InterruptedException {
cleanUp();
}

@Test
public void constructorClientConfig() {
try (ClusterPipeline pipe = new ClusterPipeline(nodes, DEFAULT_CLIENT_CONFIG)) {
Expand Down

0 comments on commit f9a8575

Please sign in to comment.