You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by sa...@apache.org on 2020/10/06 14:03:27 UTC

[geode] branch develop updated: GEODE-8538: Create test to validate ordering of redis pipeline commands (#5552)

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 <jh...@gmail.com>
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 <ri...@vmware.com>
    Co-authored-by: Darrel Schneider <da...@vmware.com>
    Co-authored-by: Jens Deppe <jd...@vmware.com>
    Co-authored-by: Sarah Abbey <sa...@vmware.com>
---
 .../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