From 35ee7622886518f85778206f905b17affcbcfd5a Mon Sep 17 00:00:00 2001 From: Jens Deppe Date: Sat, 29 Jan 2022 07:21:17 -0800 Subject: [PATCH] GEODE-9995: Use ephemeral ports to avoid port in use issues --- ...sServerStartupUsingGfshAcceptanceTest.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/geode-for-redis/src/acceptanceTest/java/org/apache/geode/redis/internal/commands/executor/GeodeRedisServerStartupUsingGfshAcceptanceTest.java b/geode-for-redis/src/acceptanceTest/java/org/apache/geode/redis/internal/commands/executor/GeodeRedisServerStartupUsingGfshAcceptanceTest.java index 6ce72a510528..1377510f1d89 100644 --- a/geode-for-redis/src/acceptanceTest/java/org/apache/geode/redis/internal/commands/executor/GeodeRedisServerStartupUsingGfshAcceptanceTest.java +++ b/geode-for-redis/src/acceptanceTest/java/org/apache/geode/redis/internal/commands/executor/GeodeRedisServerStartupUsingGfshAcceptanceTest.java @@ -108,8 +108,8 @@ public void shouldReturnErrorMessage_givenInvalidBindAddress() { @Test public void gfshStartsRedisServer_whenRedisEnabled() { - String command = - "start server --J=-Dgemfire." + ConfigurationProperties.GEODE_FOR_REDIS_ENABLED + "=true"; + String command = "start server --server-port=0 " + + "--J=-Dgemfire." + ConfigurationProperties.GEODE_FOR_REDIS_ENABLED + "=true"; gfshRule.execute(command); try (Jedis jedis = new Jedis(BIND_ADDRESS, 6379)) { @@ -120,9 +120,9 @@ public void gfshStartsRedisServer_whenRedisEnabled() { @Test public void gfshStartsRedisServer_whenCustomPort() { int port = AvailablePortHelper.getRandomAvailableTCPPort(); - String command = - "start server --J=-Dgemfire." + ConfigurationProperties.GEODE_FOR_REDIS_ENABLED + "=true" - + " --J=-Dgemfire." + ConfigurationProperties.GEODE_FOR_REDIS_PORT + "=" + port; + String command = "start server --server-port=0 " + + "--J=-Dgemfire." + ConfigurationProperties.GEODE_FOR_REDIS_ENABLED + "=true" + + " --J=-Dgemfire." + ConfigurationProperties.GEODE_FOR_REDIS_PORT + "=" + port; gfshRule.execute(command); @@ -135,11 +135,11 @@ public void gfshStartsRedisServer_whenCustomPort() { public void gfshStartsRedisServer_whenCustomPortAndBindAddress() { int port = AvailablePortHelper.getRandomAvailableTCPPort(); String anyLocal = LocalHostUtil.getAnyLocalAddress().getHostAddress(); - String command = - "start server --J=-Dgemfire." + ConfigurationProperties.GEODE_FOR_REDIS_ENABLED + "=true" - + " --J=-Dgemfire." + ConfigurationProperties.GEODE_FOR_REDIS_PORT + "=" + port - + " --J=-Dgemfire." + ConfigurationProperties.GEODE_FOR_REDIS_BIND_ADDRESS + "=" - + anyLocal; + String command = "start server --server-port=0 " + + "--J=-Dgemfire." + ConfigurationProperties.GEODE_FOR_REDIS_ENABLED + "=true" + + " --J=-Dgemfire." + ConfigurationProperties.GEODE_FOR_REDIS_PORT + "=" + port + + " --J=-Dgemfire." + ConfigurationProperties.GEODE_FOR_REDIS_BIND_ADDRESS + "=" + + anyLocal; gfshRule.execute(command); @@ -152,10 +152,10 @@ public void gfshStartsRedisServer_whenCustomPortAndBindAddress() { public void gfshDoesNotStartRedisServer_whenNotRedisEnabled() { int port = AvailablePortHelper.getRandomAvailableTCPPort(); String anyLocal = LocalHostUtil.getAnyLocalAddress().getHostAddress(); - String command = - "start server --J=-Dgemfire." + ConfigurationProperties.GEODE_FOR_REDIS_PORT + "=" + port - + " --J=-Dgemfire." + ConfigurationProperties.GEODE_FOR_REDIS_BIND_ADDRESS + "=" - + anyLocal; + String command = "start server --server-port=0 " + + "--J=-Dgemfire." + ConfigurationProperties.GEODE_FOR_REDIS_PORT + "=" + port + + " --J=-Dgemfire." + ConfigurationProperties.GEODE_FOR_REDIS_BIND_ADDRESS + "=" + + anyLocal; gfshRule.execute(command);