sabbey37 commented on a change in pull request #6121:
URL: https://github.com/apache/geode/pull/6121#discussion_r593417657



##########
File path: 
geode-redis/src/distributedTest/java/org/apache/geode/redis/internal/executor/InfoDUnitTest.java
##########
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal.executor;
+
+import static 
org.apache.geode.distributed.ConfigurationProperties.MAX_WAIT_TIME_RECONNECT;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import redis.clients.jedis.Jedis;
+
+import org.apache.geode.redis.ConcurrentLoopingThreads;
+import org.apache.geode.test.awaitility.GeodeAwaitility;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.dunit.rules.RedisClusterStartupRule;
+
+public class InfoDUnitTest {
+  @ClassRule
+  public static RedisClusterStartupRule clusterStartUp = new 
RedisClusterStartupRule(4);
+
+  private static final String LOCAL_HOST = "127.0.0.1";
+  private static final int NUM_ITERATIONS = 1000;
+  private static final int JEDIS_TIMEOUT = 
Math.toIntExact(GeodeAwaitility.getTimeout().toMillis());
+  private static final String COMMANDS_PROCESSED = "total_commands_processed";
+  private static final String REDIS_TCP_PORT = "tcp_port";
+
+  private static Jedis jedis1;
+  private static Jedis jedis2;
+
+  private static Properties locatorProperties;
+
+  private static MemberVM locator;
+  private static MemberVM server1;
+  private static MemberVM server2;
+
+  private static int redisServerPort1;
+  private static int redisServerPort2;
+
+  private static final AtomicInteger numInfoCalled = new AtomicInteger();

Review comment:
       It looks like we increment this in the `getInfo` method, but never use 
this in the test. Could it be removed? Apologies for noticing this after the 
initial review.

##########
File path: 
geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractRedisInfoStatsIntegrationTest.java
##########
@@ -60,9 +61,20 @@
   private static final String NETWORK_KB_READ_OVER_LAST_SECOND = 
"instantaneous_input_kbps";
   private static final String UPTIME_IN_DAYS = "uptime_in_days";
   private static final String UPTIME_IN_SECONDS = "uptime_in_seconds";
+  private static final String USED_MEMORY = "used_memory";
+  private static final String MEMORY_FRAGMENTATION = "mem_fragmentation_ratio";
+  private static final String TCP_PORT = "tcp_port";
+  private static final String MAX_MEMORY = "maxmemory";
 
   private static final AtomicInteger numInfoCalled = new AtomicInteger(0);
 
+  public int getExposedPort() {
+    return -1; // This must be overridden by implementation classes
+  }
+
+  public void configureMaxMemory(Jedis jedis) throws Exception {
+    throw new Exception("configureMaxMemory must be overridden");
+  }

Review comment:
       Maybe we could declare `configureMaxMemory` abstract as well, like 
`getExposedPort`

##########
File path: 
geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractRedisInfoStatsIntegrationTest.java
##########
@@ -60,9 +61,20 @@
   private static final String NETWORK_KB_READ_OVER_LAST_SECOND = 
"instantaneous_input_kbps";
   private static final String UPTIME_IN_DAYS = "uptime_in_days";
   private static final String UPTIME_IN_SECONDS = "uptime_in_seconds";
+  private static final String USED_MEMORY = "used_memory";
+  private static final String MEMORY_FRAGMENTATION = "mem_fragmentation_ratio";
+  private static final String TCP_PORT = "tcp_port";
+  private static final String MAX_MEMORY = "maxmemory";
 
   private static final AtomicInteger numInfoCalled = new AtomicInteger(0);
 
+  public int getExposedPort() {
+    return -1; // This must be overridden by implementation classes
+  }

Review comment:
       I like the way we used to do this in `AbstractInfoIntegrationTest` 
(declaring the method abstract so it had to be overridden):
   ```
   abstract int getExposedPort();
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to