[ 
https://issues.apache.org/jira/browse/GEODE-8717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17236321#comment-17236321
 ] 

ASF GitHub Bot commented on GEODE-8717:
---------------------------------------

jdeppe-pivotal commented on a change in pull request #5767:
URL: https://github.com/apache/geode/pull/5767#discussion_r527844246



##########
File path: 
geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractInfoIntegrationTest.java
##########
@@ -98,71 +165,115 @@ public void shouldReturnClusterEnabledProperty() {
     assertThat(actualResult).contains(expectedResult);
   }
 
-  final List<String> SERVER_PROPERTIES =
-      Arrays.asList(
-          "# Server",
-          "redis_version:",
-          "tcp_port:",
-          "redis_mode:");
-
-  final List<String> PERSISTENCE_PROPERTIES =
-      Arrays.asList(
-          "# Persistence",
-          "loading:");
-
-  final List<String> CLUSTER_PROPERTIES =
-      Arrays.asList(
-          "# Cluster",
-          "cluster_enabled:");
-
   @Test
-  public void shouldReturnServerSectionsGivenServerSectionParameter() {
+  public void shouldReturnServerSections_givenServerSectionParameter() {
+    List<String> nonServerProperties = ALL_PROPERTIES;
+    nonServerProperties.removeAll(SERVER_PROPERTIES);
+
     String actualResult = jedis.info("server");
 
     assertThat(actualResult).contains(SERVER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(CLUSTER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(PERSISTENCE_PROPERTIES);
+    assertThat(actualResult).doesNotContain(nonServerProperties);
   }
 
   @Test
-  public void shouldReturnClusterSectionsGivenClusterSectionParameter() {
+  public void shouldReturnClusterSections_givenClusterSectionParameter() {
+    List<String> nonClusterProperties = ALL_PROPERTIES;
+    nonClusterProperties.removeAll(CLUSTER_PROPERTIES);
+
     String actualResult = jedis.info("cluster");
 
     assertThat(actualResult).contains(CLUSTER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(SERVER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(PERSISTENCE_PROPERTIES);
+    assertThat(actualResult).doesNotContain(nonClusterProperties);
   }
 
   @Test
-  public void 
shouldReturnPersistenceSectionsGivenPersistenceSectionParameter() {
+  public void 
shouldReturnPersistenceSections_givenPersistenceSectionParameter() {
+    List<String> nonPersistenceProperties = ALL_PROPERTIES;
+    nonPersistenceProperties.removeAll(PERSISTENCE_PROPERTIES);
+
     String actualResult = jedis.info("persistence");
 
     assertThat(actualResult).contains(PERSISTENCE_PROPERTIES);
-    assertThat(actualResult).doesNotContain(SERVER_PROPERTIES);
-    assertThat(actualResult).doesNotContain(CLUSTER_PROPERTIES);
+    assertThat(actualResult).doesNotContain(nonPersistenceProperties);
+  }
+
+  @Test
+  public void shouldReturnStatsSections_givenStatsSectionParameter() {
+    List<String> nonStatsProperties = ALL_PROPERTIES;
+    nonStatsProperties.removeAll(STATS_PROPERTIES);

Review comment:
       This is going to also modify `ALL_PROPERTIES` since `nonStatsProperties` 
is just a reference. I'd suggest making `ALL_PROPERTIES` immuntable with 
something like
   ```
   .collect(Collectors.collectingAndThen(Collectors.toList(), 
Collections::unmodifiableList));
   ```
   and then it would be evident that you need to make a copy here and other 
places where this is happening.




----------------------------------------------------------------
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:
us...@infra.apache.org


> Redis INFO Command should only return specified sections when given parameter
> -----------------------------------------------------------------------------
>
>                 Key: GEODE-8717
>                 URL: https://issues.apache.org/jira/browse/GEODE-8717
>             Project: Geode
>          Issue Type: Improvement
>          Components: redis
>    Affects Versions: 1.14.0
>            Reporter: John Hutchison
>            Assignee: Raymond Ingles
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.14.0
>
>
> https://github.com/apache/geode/pull/5756



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to