Skip to content

Commit

Permalink
reset redis before ClusterCommandTest added
Browse files Browse the repository at this point in the history
  • Loading branch information
Khokhlov Aleksey committed Nov 8, 2023
1 parent e889eaf commit 132f3c9
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import redis.clients.jedis.BuilderFactory;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.args.ClusterResetType;
Expand Down Expand Up @@ -51,8 +51,17 @@ public void tearDown() {
node2.disconnect();
}

@BeforeClass
public static void resetRedisBefore() {
removeSlots();
}

@AfterClass
public static void removeSlots() throws InterruptedException {
public static void resetRedisAfter() {
removeSlots();
}

public static void removeSlots() {
try (Jedis node = new Jedis(nodeInfo1)) {
node.auth("cluster");
node.clusterReset(ClusterResetType.SOFT);
Expand Down

0 comments on commit 132f3c9

Please sign in to comment.