[
https://issues.apache.org/jira/browse/GEODE-8852?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17270213#comment-17270213
]
ASF GitHub Bot commented on GEODE-8852:
---------------------------------------
sabbey37 commented on a change in pull request #5931:
URL: https://github.com/apache/geode/pull/5931#discussion_r562707462
##########
File path:
geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHashesIntegrationTest.java
##########
@@ -373,23 +374,41 @@ public void testHVals() {
String key = "HVals_key";
String field1 = "field_1";
String field2 = "field_2";
- String value = "value";
+ String value1 = "value_1";
+ String value2 = "value_2";
- List<String> list = jedis.hvals(key);
- assertThat(list == null || list.isEmpty()).isTrue();
+ List<String> list = jedis.hvals("non-existent-key");
+ assertThat(list).isEmpty();
- Long result = jedis.hset(key, field1, value);
+ Long result = jedis.hset(key, field1, value1);
assertThat(result).isEqualTo(1);
- result = jedis.hset(key, field2, value);
+ result = jedis.hset(key, field2, value2);
assertThat(result).isEqualTo(1);
list = jedis.hvals(key);
- assertThat(list).isNotNull();
- assertThat(list).isNotEmpty();
assertThat(list).hasSize(2);
+ assertThat(list).contains(value1, value2);
+ }
- assertThat(list).contains(value);
+ @Test
+ public void hvalsFailsForNonHash() {
+ jedis.sadd("farm", "chicken");
+ assertThatThrownBy(() -> jedis.hvals("farm"))
+ .hasMessage("WRONGTYPE " + RedisConstants.ERROR_WRONG_TYPE);
+
+ jedis.set("tractor", "John Deere");
+ assertThatThrownBy(() -> jedis.hvals("tractor"))
+ .hasMessage("WRONGTYPE " + RedisConstants.ERROR_WRONG_TYPE);
+ }
+
+ @Test
+ public void hvalsFails_withIncorrectParameters() {
+ assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HVALS))
+ .hasMessageContaining("wrong number of arguments");
+
+ assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HVALS, "1",
"too-many"))
+ .hasMessageContaining("wrong number of arguments");
Review comment:
For most of the other commands (del, getset, exists, etc.) we check the
error message more closely, like:
```
.hasMessage("ERR wrong number of arguments for 'get' command");
```
I'm not sure if it's necessary, but maybe we could do the same here to be
consistent? I realize there are a few areas where we're still just checking
wrong number of arguments. We could eventually change those in a different PR.
----------------------------------------------------------------
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]
> Add additional tests for Redis HVALS command
> --------------------------------------------
>
> Key: GEODE-8852
> URL: https://issues.apache.org/jira/browse/GEODE-8852
> Project: Geode
> Issue Type: Test
> Components: redis
> Reporter: Jens Deppe
> Priority: Major
> Labels: pull-request-available
>
> Adding concurrency test as well as additional integration test
--
This message was sent by Atlassian Jira
(v8.3.4#803005)