jhutchison commented on a change in pull request #5954: URL: https://github.com/apache/geode/pull/5954#discussion_r583840637
########## 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"); + data.remove("field_3"); - assertThat(allEntries).hasSize(3); - assertThat(new HashSet<>(allEntries)).isEqualTo(entryMap.entrySet()); + GeodeAwaitility.await().untilAsserted( + () -> assertThat(jedis.hget("colors", "field_3")).isNull()); + + ScanResult<Map.Entry<String, String>> result = jedis.hscan("colors", "0"); + + assertThat(new HashSet<>(result.getResult())) + .containsExactlyInAnyOrderElementsOf(data.entrySet()); } @Test - public void givenCursorGreaterThanUnsignedLongCapacity_returnsCursorError() { - assertThatThrownBy(() -> jedis.hscan("a", "18446744073709551616")) - .hasMessageContaining(ERROR_CURSOR); + public void should_retun_not_error_given_non_zero_cursor_on_first_call() { Review comment: didn't notice. I can change ---------------------------------------------------------------- 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