This is an automated email from the ASF dual-hosted git repository.

sabbey37 pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 0c41271  GEODE-8538: Create test to validate ordering of redis 
pipeline commands (#5552)
0c41271 is described below

commit 0c412718ce97fd143231ab24585dc39d7db8bd6d
Author: John Hutchison <[email protected]>
AuthorDate: Tue Oct 6 10:02:55 2020 -0400

    GEODE-8538: Create test to validate ordering of redis pipeline commands 
(#5552)
    
    Co-authored-by: Ray Ingles <[email protected]>
    Co-authored-by: Darrel Schneider <[email protected]>
    Co-authored-by: Jens Deppe <[email protected]>
    Co-authored-by: Sarah Abbey <[email protected]>
---
 .../AbstractCommandPipeliningIntegrationTest.java  | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git 
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/AbstractCommandPipeliningIntegrationTest.java
 
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/AbstractCommandPipeliningIntegrationTest.java
index 60285b5..b80864e 100644
--- 
a/geode-redis/src/integrationTest/java/org/apache/geode/redis/AbstractCommandPipeliningIntegrationTest.java
+++ 
b/geode-redis/src/integrationTest/java/org/apache/geode/redis/AbstractCommandPipeliningIntegrationTest.java
@@ -85,6 +85,37 @@ public abstract class 
AbstractCommandPipeliningIntegrationTest implements RedisP
     
assertThat(mockSubscriber.getReceivedMessages()).isEqualTo(expectedMessages);
   }
 
+  @Test
+  public void should_returnResultsOfPipelinedCommands_inCorrectOrder() {
+    Jedis jedis = new Jedis("localhost", getPort(), REDIS_CLIENT_TIMEOUT);
+    final int NUMBER_OF_COMMANDS_IN_PIPELINE = 100;
+    int numberOfPipeLineRequests = 1000;
+
+    do {
+      Pipeline p = jedis.pipelined();
+      for (int i = 0; i < NUMBER_OF_COMMANDS_IN_PIPELINE; i++) {
+        p.echo(String.valueOf(i));
+      }
+
+      List<Object> results = p.syncAndReturnAll();
+
+      verifyResultOrder(NUMBER_OF_COMMANDS_IN_PIPELINE, results);
+      numberOfPipeLineRequests--;
+    } while (numberOfPipeLineRequests > 0);
+
+    jedis.flushAll();
+    jedis.close();
+  }
+
+  private void verifyResultOrder(final int numberOfCommandInPipeline, 
List<Object> results) {
+    for (int i = 0; i < numberOfCommandInPipeline; i++) {
+      String expected = String.valueOf(i);
+      String currentVal = (String) results.get(i);
+
+      assertThat(currentVal).isEqualTo(expected);
+    }
+  }
+
   private void waitFor(Callable<Boolean> booleanCallable) {
     GeodeAwaitility.await()
         .ignoreExceptions() // ignoring socket closed exceptions

Reply via email to