[
https://issues.apache.org/jira/browse/GEODE-8855?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17269897#comment-17269897
]
ASF GitHub Bot commented on GEODE-8855:
---------------------------------------
jhutchison commented on a change in pull request #5937:
URL: https://github.com/apache/geode/pull/5937#discussion_r562108933
##########
File path:
geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/server/AbstractRedisInfoStatsIntegrationTest.java
##########
@@ -0,0 +1,316 @@
+/*
+ * 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.server;
+
+import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.time.Duration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+
+import com.google.common.util.concurrent.AtomicDouble;
+import org.assertj.core.data.Offset;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import redis.clients.jedis.Jedis;
+
+import org.apache.geode.internal.statistics.EnabledStatisticsClock;
+import org.apache.geode.internal.statistics.StatisticsClock;
+import org.apache.geode.test.awaitility.GeodeAwaitility;
+import org.apache.geode.test.dunit.rules.RedisPortSupplier;
+
+public abstract class AbstractRedisInfoStatsIntegrationTest implements
RedisPortSupplier {
+
+ private static final int TIMEOUT = (int)
GeodeAwaitility.getTimeout().toMillis();
+ private static final String EXISTING_HASH_KEY = "Existing_Hash";
+ private static final String EXISTING_STRING_KEY = "Existing_String";
+ private static final String EXISTING_SET_KEY_1 = "Existing_Set_1";
+ private static final String EXISTING_SET_KEY_2 = "Existing_Set_2";
+
+ private Jedis jedis;
+ private static long START_TIME;
+ private static StatisticsClock statisticsClock;
+
+ private long preTestConnectionsReceived = 0;
+ private long preTestConnectedClients = 0;
+
+ private static final String COMMANDS_PROCESSED = "total_commands_processed";
+ private static final String TOTAL_CONNECTIONS_RECEIVED =
"total_connections_received";
+ private static final String CONNECTED_CLIENTS = "connected_clients";
+ private static final String OPS_PERFORMED_OVER_LAST_SECOND =
"instantaneous_ops_per_sec";
+ private static final String TOTAL_NETWORK_BYTES_READ =
"total_net_input_bytes";
+ 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 AtomicInteger numInfoCalled = new AtomicInteger(0);
+
+
+ // ------------------- Setup -------------------------- //
+ @BeforeClass
+ public static void beforeClass() {
+ statisticsClock = new EnabledStatisticsClock();
+ START_TIME = statisticsClock.getTime();
+ }
+
+ @Before
+ public void before() {
+ jedis = new Jedis("localhost", getPort(), TIMEOUT);
+ numInfoCalled.set(0);
+
+ long preSetupCommandsProcessed =
Long.valueOf(getInfo(jedis).get(COMMANDS_PROCESSED));
+
+ jedis.set(EXISTING_STRING_KEY, "A_Value");
+ jedis.hset(EXISTING_HASH_KEY, "Field1", "Value1");
+ jedis.sadd(EXISTING_SET_KEY_1, "m1", "m2", "m3");
+ jedis.sadd(EXISTING_SET_KEY_2, "m4", "m5", "m6");
+
+ await().atMost(Duration.ofSeconds(2))
+ .untilAsserted(() -> assertThat(
+ Long.valueOf(getInfo(jedis).get(COMMANDS_PROCESSED)) -
numInfoCalled.get() + 1)
Review comment:
these "magic numbers" still seem like they make things more complicated
and confusing for anyone coming in in the future. If it's not possible to
incorporate the offset into one fo the delegate methods, can we at least assign
them to variables that indicate why we need to add +1 sometimes to these
calculations?
----------------------------------------------------------------
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]
> Redis Integration Test: add tests for all commands to
> redisStatsIntegrationTest
> -------------------------------------------------------------------------------
>
> Key: GEODE-8855
> URL: https://issues.apache.org/jira/browse/GEODE-8855
> Project: Geode
> Issue Type: Test
> Components: redis
> Reporter: Helena Bales
> Priority: Major
> Labels: pull-request-available
>
> add tests for the unsupported commands and the rest of the untested commands.
> organize the tests. make the tests run against redis and native redis. remove
> duplicate tests from the hitsmisses test.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)