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

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

jhutchison commented on a change in pull request #5954:
URL: https://github.com/apache/geode/pull/5954#discussion_r578543728



##########
File path: 
geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHScanIntegrationTest.java
##########
@@ -237,15 +326,42 @@ public void 
givenMultipleCounts_returnsAllEntriesWithoutDuplicates() {
     String cursor = "0";
 
     do {
-      result = (List<Object>) jedis.sendCommand(Protocol.Command.HSCAN, 
"colors", cursor, "COUNT",
-          "2", "COUNT", "1");
+      result = (List<Object>) jedis.sendCommand(Protocol.Command.HSCAN,
+          "colors",
+          cursor,
+          "COUNT", "2",
+          "COUNT", "1");
+
       allEntries.addAll((List<byte[]>) result.get(1));
       cursor = new String((byte[]) result.get(0));
     } while (!Arrays.equals((byte[]) result.get(0), "0".getBytes()));
 
     assertThat((byte[]) result.get(0)).isEqualTo("0".getBytes());
-    assertThat(allEntries).containsExactlyInAnyOrder("1".getBytes(), 
"yellow".getBytes(),
-        "12".getBytes(), "green".getBytes(), "3".getBytes(), 
"grey".getBytes());
+
+    assertThat(allEntries.size()).isCloseTo(3, Offset.offset(1));
+  }
+
+  @Test
+  public void givenCompleteIteration_shouldReturnCursorWithValueOfZero() {
+    Map<String, String> entryMap = new HashMap<>();
+    entryMap.put("1", "yellow");
+    entryMap.put("2", "green");
+    entryMap.put("3", "orange");
+    jedis.hmset("colors", entryMap);
+
+    ScanParams scanParams = new ScanParams();
+    scanParams.count(1);
+    ScanResult<Map.Entry<String, String>> result;
+    List<Map.Entry<String, String>> allEntries = new ArrayList<>();
+    String cursor = "0";
+
+    do {
+      result = jedis.hscan("colors", cursor, scanParams);
+      allEntries.addAll(result.getResult());
+      cursor = result.getCursor();
+    } while (!result.isCompleteIteration());
+
+    assertThat(result.getCursor()).isEqualTo("0");

Review comment:
       there is a separate test that's been added to verify that hscans don't 
change the data.  If that doesn't seem like enough let me know.




----------------------------------------------------------------
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]


> finish implementation of Redis HScan Command
> --------------------------------------------
>
>                 Key: GEODE-8864
>                 URL: https://issues.apache.org/jira/browse/GEODE-8864
>             Project: Geode
>          Issue Type: New Feature
>          Components: redis
>            Reporter: John Hutchison
>            Priority: Major
>              Labels: pull-request-available
>




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

Reply via email to