[ https://issues.apache.org/jira/browse/GEODE-8864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17294207#comment-17294207 ]
ASF GitHub Bot commented on GEODE-8864: --------------------------------------- sabbey37 commented on a change in pull request #5954: URL: https://github.com/apache/geode/pull/5954#discussion_r583054944 ########## File path: geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHScanIntegrationTest.java ########## @@ -237,15 +316,40 @@ 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()); + } + + @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"); } @Test Review comment: There are some other tests (that Darrel and I added) that check exact matches between what's expected and what's returned. Given previous comments/changes (and knowing that native Redis doesn't guarantee an element will only be returned once), I'm wondering if it makes sense to change these as well to check `containsAll()` vs. `containsExactlyInAnyOrder()` or `equals()`, etc. ---------------------------------------------------------------- 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: us...@infra.apache.org > 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: blocks-1.14.0, pull-request-available > -- This message was sent by Atlassian Jira (v8.3.4#803005)