jhutchison commented on a change in pull request #5818:
URL: https://github.com/apache/geode/pull/5818#discussion_r541060729
##########
File path:
geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/RedisStatsIntegrationTest.java
##########
@@ -468,33 +479,33 @@ public void
NetworkKiloBytesReadOverLastSecond_shouldReturnCorrectData() {
}
-
// ######################### Clients Section
#################################
@Test
public void clientsStat_withConnectAndClose_isCorrect() {
- jedis = new Jedis("localhost", server.getPort(), TIMEOUT);
- jedis.ping();
+ Jedis jedis2 = new Jedis("localhost", server.getPort(), TIMEOUT);
+ jedis2.ping();
- assertThat(redisStats.getConnectedClients()).isEqualTo(1);
+
assertThat(redisStats.getConnectedClients()).isEqualTo(preTestConnectedClients
+ 1);
- jedis.close();
+ jedis2.close();
GeodeAwaitility.await().atMost(Duration.ofSeconds(2))
- .untilAsserted(() ->
assertThat(redisStats.getConnectedClients()).isEqualTo(0));
+ .untilAsserted(
+ () ->
assertThat(redisStats.getConnectedClients()).isEqualTo(preTestConnectedClients));
}
@Test
public void
connectionsReceivedStat_shouldIncrement_WhenNewConnectionOccurs() {
- jedis = new Jedis("localhost", server.getPort(), TIMEOUT);
- jedis.ping();
+ Jedis jedis2 = new Jedis("localhost", server.getPort(), TIMEOUT);
+ jedis2.ping();
- assertThat(redisStats.getConnectionsReceived()).isEqualTo(1);
+
assertThat(redisStats.getConnectionsReceived()).isEqualTo(preTestConnectionsReceived
+ 1);
- jedis.close();
+ jedis2.close();
- assertThat(redisStats.getConnectionsReceived()).isEqualTo(1);
+
assertThat(redisStats.getConnectionsReceived()).isEqualTo(preTestConnectionsReceived
+ 1);
Review comment:
I'm not sure how we can make this more clear, but I see how this is
confusing- this test is testing the connectionsReceived parameter, which keeps
the history of connections received, even after they have been closed. (the
getConnectedlClient param, in the test above is about current active
connections only)
----------------------------------------------------------------
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]