Skip to content

Commit

Permalink
GEODE-9506: Do not use random ephemeral port to start Redis servers (a…
Browse files Browse the repository at this point in the history
…pache#6790)

Authored-by: Donal Evans <[email protected]>
  • Loading branch information
DonalEvans authored Aug 24, 2021
1 parent 7f4afe6 commit fdda7db
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ public class SessionsAndCrashesDUnitTest {
private static final int NUM_SESSIONS = 100;
private static final List<String> sessionIds = new ArrayList<>(NUM_SESSIONS);
private static MemberVM locator;
private static MemberVM server1;
private static MemberVM server2;
private static MemberVM server3;
private static int[] redisPorts;
private static JedisCluster jedis;

private SessionRepository<Session> sessionRepository;
private ConfigurableApplicationContext springContext;
Expand All @@ -75,16 +73,13 @@ public class SessionsAndCrashesDUnitTest {
public static void classSetup() {
locator = cluster.startLocatorVM(0);

server1 = startRedisVM(1, 0);
server2 = startRedisVM(2, 0);
server3 = startRedisVM(3, 0);
redisPorts = AvailablePortHelper.getRandomAvailableTCPPorts(3);

redisPorts = new int[] {
cluster.getRedisPort(1),
cluster.getRedisPort(2),
cluster.getRedisPort(3)};
startRedisVM(1, redisPorts[0]);
server2 = startRedisVM(2, redisPorts[1]);
server3 = startRedisVM(3, redisPorts[2]);

jedis = new JedisCluster(new HostAndPort("localhost", redisPorts[0]), JEDIS_TIMEOUT);
new JedisCluster(new HostAndPort("localhost", redisPorts[0]), JEDIS_TIMEOUT);
}

private static MemberVM startRedisVM(int vmId, Integer redisPort) {
Expand Down

0 comments on commit fdda7db

Please sign in to comment.