DonalEvans commented on a change in pull request #7228:
URL: https://github.com/apache/geode/pull/7228#discussion_r787945659
##########
File path:
geode-for-redis/src/integrationTest/java/org/apache/geode/redis/internal/commands/executor/set/AbstractSRandMemberIntegrationTest.java
##########
@@ -64,84 +66,100 @@ public void srandmemberTooManyArgs_returnsError() {
}
@Test
- public void srandmemberWithInvalidCount_returnsError() {
+ public void srandmember_withInvalidCount_returnsError() {
assertThatThrownBy(() -> jedis.sendCommand(SET_KEY,
Protocol.Command.SRANDMEMBER, SET_KEY, "b"))
.hasMessageContaining(ERROR_NOT_INTEGER);
}
@Test
- public void srandmemberWithoutCount_withNonExistentSet_returnsNull() {
+ public void srandmember_withoutCount_withNonExistentSet_returnsNull() {
assertThat(jedis.srandmember(NON_EXISTENT_SET_KEY)).isNull();
assertThat(jedis.exists(NON_EXISTENT_SET_KEY)).isFalse();
}
@Test
- public void srandmemberWithCount_withNonExistentSet_returnsEmptySet() {
- assertThat(jedis.srandmember(NON_EXISTENT_SET_KEY, 1)).isEmpty();
- assertThat(jedis.exists(NON_EXISTENT_SET_KEY)).isFalse();
+ public void srandmember_withoutCount_withExistentSet_returnsOneMember() {
+ jedis.sadd(SET_KEY, SET_MEMBERS);
+
+ String result = jedis.srandmember(SET_KEY);
+ assertThat(result).isIn(Arrays.asList(SET_MEMBERS));
}
@Test
- public void srandmemberWithoutCount_withExistentSet_returnsOneMember() {
+ public void srandmember_withCountAsZero_withExistentSet_returnsSubsetOfSet()
{
Review comment:
This test name is inaccurate. It seems like it should be
"srandmember_withCountAsZero_withExistentSet_returnsEmptyList"
##########
File path:
geode-for-redis/src/integrationTest/java/org/apache/geode/redis/internal/commands/executor/set/AbstractSRandMemberIntegrationTest.java
##########
@@ -0,0 +1,167 @@
+/*
+ * 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.commands.executor.set;
+
+import static
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtLeastNArgs;
+import static org.apache.geode.redis.internal.RedisConstants.ERROR_NOT_INTEGER;
+import static org.apache.geode.redis.internal.RedisConstants.ERROR_SYNTAX;
+import static org.apache.geode.redis.internal.RedisConstants.ERROR_WRONG_TYPE;
+import static
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS;
+import static
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.REDIS_CLIENT_TIMEOUT;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+import redis.clients.jedis.Protocol;
+
+import org.apache.geode.redis.RedisIntegrationTest;
+
+public abstract class AbstractSRandMemberIntegrationTest implements
RedisIntegrationTest {
+ private JedisCluster jedis;
+ private static final String NON_EXISTENT_SET_KEY = "{user1}nonExistentSet";
+ private static final String SET_KEY = "{user1}setKey";
Review comment:
Sorry I didn't catch this earlier, but could these tags be `{tag1}` to
follow the new convention?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]