10
10
import org .junit .After ;
11
11
import org .junit .AfterClass ;
12
12
import org .junit .Before ;
13
+ import org .junit .BeforeClass ;
13
14
import org .junit .Test ;
14
15
15
16
import redis .clients .jedis .args .*;
23
24
import redis .clients .jedis .util .JedisClusterTestUtil ;
24
25
import redis .clients .jedis .util .SafeEncoder ;
25
26
26
- // SLOW
27
- // TODO: make it fast
28
27
public class ClusterPipeliningTest {
29
28
30
29
private static final String LOCAL_IP = "127.0.0.1" ;
@@ -36,13 +35,13 @@ public class ClusterPipeliningTest {
36
35
private static Jedis node2 ;
37
36
private static Jedis node3 ;
38
37
39
- private HostAndPort nodeInfo1 = HostAndPorts .getClusterServers ().get (0 );
40
- private HostAndPort nodeInfo2 = HostAndPorts .getClusterServers ().get (1 );
41
- private HostAndPort nodeInfo3 = HostAndPorts .getClusterServers ().get (2 );
38
+ private static HostAndPort nodeInfo1 = HostAndPorts .getClusterServers ().get (0 );
39
+ private static HostAndPort nodeInfo2 = HostAndPorts .getClusterServers ().get (1 );
40
+ private static HostAndPort nodeInfo3 = HostAndPorts .getClusterServers ().get (2 );
42
41
private Set <HostAndPort > nodes = new HashSet <>(Arrays .asList (nodeInfo1 , nodeInfo2 , nodeInfo3 ));
43
42
44
- @ Before
45
- public void setUp () throws InterruptedException {
43
+ @ BeforeClass
44
+ public static void setUp () throws InterruptedException {
46
45
node1 = new Jedis (nodeInfo1 );
47
46
node1 .auth ("cluster" );
48
47
node1 .flushAll ();
@@ -81,8 +80,22 @@ public void setUp() throws InterruptedException {
81
80
JedisClusterTestUtil .waitForClusterReady (node1 , node2 , node3 );
82
81
}
83
82
83
+ @ Before
84
+ public void prepare () {
85
+ node1 .flushAll ();
86
+ node2 .flushAll ();
87
+ node3 .flushAll ();
88
+ }
89
+
90
+ @ After
91
+ public void cleanUp () {
92
+ node1 .flushDB ();
93
+ node2 .flushDB ();
94
+ node3 .flushDB ();
95
+ }
96
+
84
97
@ AfterClass
85
- public static void cleanUp () {
98
+ public static void tearDown () throws InterruptedException {
86
99
node1 .flushDB ();
87
100
node2 .flushDB ();
88
101
node3 .flushDB ();
@@ -91,11 +104,6 @@ public static void cleanUp() {
91
104
node3 .clusterReset (ClusterResetType .SOFT );
92
105
}
93
106
94
- @ After
95
- public void tearDown () throws InterruptedException {
96
- cleanUp ();
97
- }
98
-
99
107
@ Test
100
108
public void constructorClientConfig () {
101
109
try (ClusterPipeline pipe = new ClusterPipeline (nodes , DEFAULT_CLIENT_CONFIG )) {
0 commit comments