You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by je...@apache.org on 2022/02/01 20:44:06 UTC

[geode] branch support/1.15 updated (3f56bd3 -> 55396d4)

This is an automated email from the ASF dual-hosted git repository.

jensdeppe pushed a change to branch support/1.15
in repository https://gitbox.apache.org/repos/asf/geode.git.


    from 3f56bd3  GEODE-9835: Add SSCAN to Redis supported commands (#7278)
     new 9f021cf  GEODE-9958: Add gfsh-specific tests for Radish startup (#7297)
     new 55396d4  GEODE-9995: Use ephemeral ports to avoid port in use issues (#7329)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../GeodeRedisServerStartupAcceptanceTest.java     |  5 --
 ...eRedisServerStartupUsingGfshAcceptanceTest.java | 65 ++++++++++++++++++++++
 2 files changed, 65 insertions(+), 5 deletions(-)

[geode] 02/02: GEODE-9995: Use ephemeral ports to avoid port in use issues (#7329)

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jensdeppe pushed a commit to branch support/1.15
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 55396d4650f5214b27982b43ea7b59d05a23ba55
Author: Jens Deppe <jd...@vmware.com>
AuthorDate: Mon Jan 31 12:04:15 2022 -0800

    GEODE-9995: Use ephemeral ports to avoid port in use issues (#7329)
    
    (cherry picked from commit 00ccce2a652e6fe21b8af8a162cff35ab47f036c)
---
 ...eRedisServerStartupUsingGfshAcceptanceTest.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 6ce72a5..1377510 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 class GeodeRedisServerStartupUsingGfshAcceptanceTest {
 
   @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 class GeodeRedisServerStartupUsingGfshAcceptanceTest {
   @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 class GeodeRedisServerStartupUsingGfshAcceptanceTest {
   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 class GeodeRedisServerStartupUsingGfshAcceptanceTest {
   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);
 

[geode] 01/02: GEODE-9958: Add gfsh-specific tests for Radish startup (#7297)

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jensdeppe pushed a commit to branch support/1.15
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 9f021cf6f6216f9a8db6d395b07b9b74745cf75d
Author: Jens Deppe <jd...@vmware.com>
AuthorDate: Fri Jan 21 19:57:42 2022 -0800

    GEODE-9958: Add gfsh-specific tests for Radish startup (#7297)
    
    (cherry picked from commit 77945531fafd566a0cbca7d05b5347b8ea299efc)
---
 .../GeodeRedisServerStartupAcceptanceTest.java     |  5 --
 ...eRedisServerStartupUsingGfshAcceptanceTest.java | 65 ++++++++++++++++++++++
 2 files changed, 65 insertions(+), 5 deletions(-)

diff --git a/geode-for-redis/src/acceptanceTest/java/org/apache/geode/redis/GeodeRedisServerStartupAcceptanceTest.java b/geode-for-redis/src/acceptanceTest/java/org/apache/geode/redis/GeodeRedisServerStartupAcceptanceTest.java
index f16214c..523e63c 100644
--- a/geode-for-redis/src/acceptanceTest/java/org/apache/geode/redis/GeodeRedisServerStartupAcceptanceTest.java
+++ b/geode-for-redis/src/acceptanceTest/java/org/apache/geode/redis/GeodeRedisServerStartupAcceptanceTest.java
@@ -28,7 +28,6 @@ import java.net.BindException;
 import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 
-import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -43,16 +42,12 @@ import org.apache.geode.test.dunit.rules.ClusterStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.dunit.rules.RedisClusterStartupRule;
 import org.apache.geode.test.junit.categories.IgnoreInRepeatTestTasks;
-import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 public class GeodeRedisServerStartupAcceptanceTest {
 
   @Rule
   public RedisClusterStartupRule cluster = new RedisClusterStartupRule();
 
-  @ClassRule
-  public static GfshCommandRule gfsh = new GfshCommandRule();
-
   @Category(IgnoreInRepeatTestTasks.class)
   @Test
   public void startupOnDefaultPort() {
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 5827ccb..6ce72a5 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
@@ -15,7 +15,9 @@
 
 package org.apache.geode.redis.internal.commands.executor;
 
+import static org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS;
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
@@ -23,8 +25,12 @@ import java.net.ServerSocket;
 
 import org.junit.Rule;
 import org.junit.Test;
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.exceptions.JedisConnectionException;
 
+import org.apache.geode.distributed.ConfigurationProperties;
 import org.apache.geode.internal.AvailablePortHelper;
+import org.apache.geode.internal.inet.LocalHostUtil;
 import org.apache.geode.test.junit.rules.gfsh.GfshExecution;
 import org.apache.geode.test.junit.rules.gfsh.GfshRule;
 import org.apache.geode.test.junit.rules.gfsh.GfshScript;
@@ -99,4 +105,63 @@ public class GeodeRedisServerStartupUsingGfshAcceptanceTest {
     assertThat(execution.getOutputText()).containsIgnoringCase(
         "The geode-for-redis-bind-address 1.1.1.1 is not a valid address for this machine");
   }
+
+  @Test
+  public void gfshStartsRedisServer_whenRedisEnabled() {
+    String command =
+        "start server --J=-Dgemfire." + ConfigurationProperties.GEODE_FOR_REDIS_ENABLED + "=true";
+    gfshRule.execute(command);
+
+    try (Jedis jedis = new Jedis(BIND_ADDRESS, 6379)) {
+      assertThat(jedis.ping()).isEqualTo("PONG");
+    }
+  }
+
+  @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;
+
+    gfshRule.execute(command);
+
+    try (Jedis jedis = new Jedis(BIND_ADDRESS, port)) {
+      assertThat(jedis.ping()).isEqualTo("PONG");
+    }
+  }
+
+  @Test
+  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;
+
+    gfshRule.execute(command);
+
+    try (Jedis jedis = new Jedis(anyLocal, port)) {
+      assertThat(jedis.ping()).isEqualTo("PONG");
+    }
+  }
+
+  @Test
+  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;
+
+    gfshRule.execute(command);
+
+    try (Jedis jedis = new Jedis(BIND_ADDRESS, port)) {
+      assertThatThrownBy(() -> jedis.ping()).isInstanceOf(JedisConnectionException.class);
+    }
+  }
+
 }