jhutchison commented on a change in pull request #5954: URL: https://github.com/apache/geode/pull/5954#discussion_r583733973
########## File path: geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHScanIntegrationTest.java ########## @@ -336,48 +441,136 @@ public void givenMultipleCountsAndMatches_returnsEntriesMatchingLastMatchParamet } @Test - public void givenNegativeCursor_returnsEntriesUsingAbsoluteValueOfCursor() { - Map<String, String> entryMap = new HashMap<>(); - entryMap.put("1", "yellow"); - entryMap.put("2", "green"); - entryMap.put("3", "orange"); - jedis.hmset("colors", entryMap); + public void should_notReturnValue_givenValueWasRemovedBeforeHSCANISCalled() { - String cursor = "-100"; - ScanResult<Map.Entry<String, String>> result; - List<Map.Entry<String, String>> allEntries = new ArrayList<>(); + Map<String, String> data = new HashMap<>(); + data.put("field_1", "yellow"); + data.put("field_2", "green"); + data.put("field_3", "grey"); + jedis.hmset("colors", data); - do { - result = jedis.hscan("colors", cursor); - allEntries.addAll(result.getResult()); - cursor = result.getCursor(); - } while (!result.isCompleteIteration()); + jedis.hdel("colors", "field_3"); Review comment: So hscan promises a few things, essentially boiling down to any change that occurs before an hscan starts will be reflected in the results, but there are less promises around changes that happen during an hscan. This test is just reflecting the first guarantee- if a value is deleted before the hscan, it will not show up in the hscan (even if it was in the hash before the hscan started). I agree it seems obvious, but it seems like part of the contract, so it's tested. ---------------------------------------------------------------- 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