ringles commented on a change in pull request #7261:
URL: https://github.com/apache/geode/pull/7261#discussion_r808060461



##########
File path: 
geode-for-redis/src/integrationTest/java/org/apache/geode/redis/internal/commands/executor/list/AbstractLPushIntegrationTest.java
##########
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.commands.executor.list;
+
+import static 
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtLeastNArgs;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.REDIS_CLIENT_TIMEOUT;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+import redis.clients.jedis.Protocol;
+import redis.clients.jedis.exceptions.JedisDataException;
+
+import org.apache.geode.redis.RedisIntegrationTest;
+
+public abstract class AbstractLPushIntegrationTest implements 
RedisIntegrationTest {
+  public static final String KEY = "key";
+  public static final String PREEXISTING_VALUE = "preexistingValue";
+  private JedisCluster jedis;
+
+  @Before
+  public void setUp() {
+    jedis = new JedisCluster(new HostAndPort(BIND_ADDRESS, getPort()), 
REDIS_CLIENT_TIMEOUT);
+  }
+
+  @After
+  public void tearDown() {
+    flushAll();
+    jedis.close();
+  }
+
+  @Test
+  public void lpushErrors_givenTooFewArguments() {
+    assertAtLeastNArgs(jedis, Protocol.Command.LPUSH, 2);
+  }
+
+  @Test
+  public void 
lpush_withExistingKey_ofWrongType_returnsWrongTypeError_shouldNotOverWriteExistingKey()
 {
+    String elementValue = "list element value that should never get added";
+
+    jedis.set(KEY, PREEXISTING_VALUE);
+
+    assertThatThrownBy(() -> jedis.lpush(KEY, 
elementValue)).isInstanceOf(JedisDataException.class);

Review comment:
       Done.

##########
File path: 
geode-for-redis/src/integrationTest/java/org/apache/geode/redis/internal/commands/executor/list/AbstractLPopIntegrationTest.java
##########
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.commands.executor.list;
+
+import static 
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtMostNArgs;
+import static org.apache.geode.redis.internal.RedisConstants.ERROR_WRONG_TYPE;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.REDIS_CLIENT_TIMEOUT;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+import redis.clients.jedis.Protocol;
+
+import org.apache.geode.redis.ConcurrentLoopingThreads;
+import org.apache.geode.redis.RedisIntegrationTest;
+
+public abstract class AbstractLPopIntegrationTest implements 
RedisIntegrationTest {
+  public static final String KEY = "key";
+  public static final String PREEXISTING_VALUE = "preexistingValue";
+  // TODO: make private when we implement Redis 6.2+ behavior for LPOP
+  protected JedisCluster jedis;
+
+  @Before
+  public void setUp() {
+    jedis = new JedisCluster(new HostAndPort(BIND_ADDRESS, getPort()), 
REDIS_CLIENT_TIMEOUT);
+  }
+
+  @After
+  public void tearDown() {
+    flushAll();
+    jedis.close();
+  }
+
+  // Overridden in LPopIntegrationTest until we implement Redis 6.2+ semantics
+  @Test
+  public void lpop_givenWrongNumOfArgs_returnsError() {
+    assertAtMostNArgs(jedis, Protocol.Command.LPOP, 2);
+  }
+
+  @Test
+  public void lpop_withNonListKey_Fails() {
+    jedis.set("string", PREEXISTING_VALUE);
+    assertThatThrownBy(() -> 
jedis.lpop("string")).hasMessageContaining(ERROR_WRONG_TYPE);

Review comment:
       Done.

##########
File path: 
geode-for-redis/src/integrationTest/java/org/apache/geode/redis/internal/commands/executor/list/AbstractLPopIntegrationTest.java
##########
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.commands.executor.list;
+
+import static 
org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtMostNArgs;
+import static org.apache.geode.redis.internal.RedisConstants.ERROR_WRONG_TYPE;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.REDIS_CLIENT_TIMEOUT;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+import redis.clients.jedis.Protocol;
+
+import org.apache.geode.redis.ConcurrentLoopingThreads;
+import org.apache.geode.redis.RedisIntegrationTest;
+
+public abstract class AbstractLPopIntegrationTest implements 
RedisIntegrationTest {
+  public static final String KEY = "key";
+  public static final String PREEXISTING_VALUE = "preexistingValue";
+  // TODO: make private when we implement Redis 6.2+ behavior for LPOP
+  protected JedisCluster jedis;
+
+  @Before
+  public void setUp() {
+    jedis = new JedisCluster(new HostAndPort(BIND_ADDRESS, getPort()), 
REDIS_CLIENT_TIMEOUT);
+  }
+
+  @After
+  public void tearDown() {
+    flushAll();
+    jedis.close();
+  }
+
+  // Overridden in LPopIntegrationTest until we implement Redis 6.2+ semantics
+  @Test
+  public void lpop_givenWrongNumOfArgs_returnsError() {
+    assertAtMostNArgs(jedis, Protocol.Command.LPOP, 2);
+  }
+
+  @Test
+  public void lpop_withNonListKey_Fails() {
+    jedis.set("string", PREEXISTING_VALUE);
+    assertThatThrownBy(() -> 
jedis.lpop("string")).hasMessageContaining(ERROR_WRONG_TYPE);
+  }
+
+  @Test
+  public void lpop_withNonExistentKey_returnsNull() {
+    assertThat(jedis.lpop("nonexistent")).isNull();
+  }
+
+  @Test
+  public void lpop_returnsLeftmostMember() {
+    jedis.lpush(KEY, "e1", "e2");
+    String result = jedis.lpop(KEY);
+    assertThat(result).isEqualTo("e2");
+  }
+
+  @Test
+  public void lpop_removesKey_whenLastElementRemoved() {
+    final String keyWithTagForKeysCommand = "{tag}" + KEY;
+
+    jedis.lpush(keyWithTagForKeysCommand, "e1");
+    jedis.lpop(keyWithTagForKeysCommand);
+    assertThat(jedis.keys(keyWithTagForKeysCommand)).isEmpty();
+  }
+
+  @Test
+  public void lpop_removesKey_whenLastElementRemoved_multipleTimes() {
+    final String key = KEY;
+
+    jedis.lpush(key, "e1");
+    assertThat(jedis.lpop(key)).isEqualTo("e1");
+    assertThat(jedis.lpop(key)).isNull();
+    assertThat(jedis.lpop(key)).isNull();
+    assertThat(jedis.exists(key)).isFalse();
+  }
+
+  @Test
+  public void lpop_withConcurrentLPush_returnsCorrectValue() {
+    String[] valuesInitial = new String[] {"un", "deux", "troix"};
+    String[] valuesToAdd = new String[] {"plum", "peach", "orange"};
+    jedis.lpush(KEY, valuesInitial);
+
+    final AtomicReference<String> lpopReference = new AtomicReference<>();
+    new ConcurrentLoopingThreads(1000,
+        i -> jedis.lpush(KEY, valuesToAdd),
+        i -> lpopReference.set(jedis.lpop(KEY)))
+            .runWithAction(() -> {
+              assertThat(lpopReference).satisfiesAnyOf(
+                  lpopResult -> 
assertThat(lpopReference.get()).isEqualTo("orange"),
+                  lpopResult -> 
assertThat(lpopReference.get()).isEqualTo("troix"),
+                  lpopResult -> assertThat(lpopReference.get()).isNull());

Review comment:
       Leftover from earlier iteration.

##########
File path: 
geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/commands/executor/list/LPopDUnitTest.java
##########
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal.commands.executor.list;
+
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.REDIS_CLIENT_TIMEOUT;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+
+import org.apache.geode.test.awaitility.GeodeAwaitility;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.dunit.rules.RedisClusterStartupRule;
+import org.apache.geode.test.junit.rules.ExecutorServiceRule;
+
+public class LPopDUnitTest {
+  public static final int MINIMUM_ITERATIONS = 10000;
+  private static MemberVM locator;
+
+  @ClassRule
+  public static RedisClusterStartupRule clusterStartUp = new 
RedisClusterStartupRule();
+
+  @Rule
+  public ExecutorServiceRule executor = new ExecutorServiceRule();
+
+  private static JedisCluster jedis;
+
+  @BeforeClass
+  public static void classSetup() {
+    locator = clusterStartUp.startLocatorVM(0);
+    clusterStartUp.startRedisVM(2, locator.getPort());
+    clusterStartUp.startRedisVM(3, locator.getPort());
+  }
+
+  @Before
+  public void testSetup() {
+    clusterStartUp.startRedisVM(1, locator.getPort());
+    int redisServerPort = clusterStartUp.getRedisPort(1);
+    jedis = new JedisCluster(new HostAndPort(BIND_ADDRESS, redisServerPort), 
REDIS_CLIENT_TIMEOUT);
+    clusterStartUp.flushAll();
+  }
+
+  @After
+  public void tearDown() {
+    jedis.close();
+  }
+
+  @Test
+  public void shouldDistributeDataAmongCluster_andRetainDataAfterServerCrash() 
{
+    String key = makeListKeyWithHashtag(1, 
clusterStartUp.getKeyOnServer("lpop", 1));
+    List<String> elementList = makeElementList(key, MINIMUM_ITERATIONS);
+    lpushPerformAndVerify(key, elementList);
+
+    // Remove all but last element
+    for (int i = MINIMUM_ITERATIONS - 1; i > 0; i--) {
+      assertThat(jedis.lpop(key)).isEqualTo(makeElementString(key, i));
+    }
+    clusterStartUp.crashVM(1); // kill primary server
+
+    assertThat(jedis.lpop(key)).isEqualTo(makeElementString(key, 0));

Review comment:
       Done.

##########
File path: 
geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/commands/executor/list/LPopDUnitTest.java
##########
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal.commands.executor.list;
+
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.REDIS_CLIENT_TIMEOUT;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+
+import org.apache.geode.test.awaitility.GeodeAwaitility;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.dunit.rules.RedisClusterStartupRule;
+import org.apache.geode.test.junit.rules.ExecutorServiceRule;
+
+public class LPopDUnitTest {
+  public static final int MINIMUM_ITERATIONS = 10000;
+  private static MemberVM locator;
+
+  @ClassRule
+  public static RedisClusterStartupRule clusterStartUp = new 
RedisClusterStartupRule();
+
+  @Rule
+  public ExecutorServiceRule executor = new ExecutorServiceRule();
+
+  private static JedisCluster jedis;
+
+  @BeforeClass
+  public static void classSetup() {
+    locator = clusterStartUp.startLocatorVM(0);
+    clusterStartUp.startRedisVM(2, locator.getPort());
+    clusterStartUp.startRedisVM(3, locator.getPort());
+  }
+
+  @Before
+  public void testSetup() {
+    clusterStartUp.startRedisVM(1, locator.getPort());
+    int redisServerPort = clusterStartUp.getRedisPort(1);
+    jedis = new JedisCluster(new HostAndPort(BIND_ADDRESS, redisServerPort), 
REDIS_CLIENT_TIMEOUT);
+    clusterStartUp.flushAll();
+  }
+
+  @After
+  public void tearDown() {
+    jedis.close();
+  }
+
+  @Test
+  public void shouldDistributeDataAmongCluster_andRetainDataAfterServerCrash() 
{
+    String key = makeListKeyWithHashtag(1, 
clusterStartUp.getKeyOnServer("lpop", 1));
+    List<String> elementList = makeElementList(key, MINIMUM_ITERATIONS);
+    lpushPerformAndVerify(key, elementList);
+
+    // Remove all but last element
+    for (int i = MINIMUM_ITERATIONS - 1; i > 0; i--) {
+      assertThat(jedis.lpop(key)).isEqualTo(makeElementString(key, i));
+    }
+    clusterStartUp.crashVM(1); // kill primary server
+
+    assertThat(jedis.lpop(key)).isEqualTo(makeElementString(key, 0));
+    assertThat(jedis.exists(key)).isFalse();
+  }
+
+  @Test
+  public void givenBucketsMoveDuringLpop_thenOperationsAreNotLost() throws 
Exception {
+    AtomicLong runningCount = new AtomicLong(3);
+    List<String> listHashtags = makeListHashtags();
+    List<String> keys = makeListKeys(listHashtags);
+
+    List<String> elementList1 = makeElementList(keys.get(0), 
MINIMUM_ITERATIONS);
+    List<String> elementList2 = makeElementList(keys.get(1), 
MINIMUM_ITERATIONS);
+    List<String> elementList3 = makeElementList(keys.get(2), 
MINIMUM_ITERATIONS);
+
+    lpushPerformAndVerify(keys.get(0), elementList1);
+    lpushPerformAndVerify(keys.get(1), elementList2);
+    lpushPerformAndVerify(keys.get(2), elementList3);
+
+    Runnable task1 =
+        () -> lpopPerformAndVerify(keys.get(0), runningCount);
+    Runnable task2 =
+        () -> lpopPerformAndVerify(keys.get(1), runningCount);
+    Runnable task3 =
+        () -> lpopPerformAndVerify(keys.get(2), runningCount);
+
+    Future<Void> future1 = executor.runAsync(task1);
+    Future<Void> future2 = executor.runAsync(task2);
+    Future<Void> future3 = executor.runAsync(task3);
+
+    for (int i = 0; i < 50 && runningCount.get() > 0; i++) {
+      clusterStartUp.moveBucketForKey(listHashtags.get(i % 
listHashtags.size()));
+      GeodeAwaitility.await().during(Duration.ofMillis(500)).until(() -> true);

Review comment:
       There are a few of these in other tests. We'll need a ticket to clean 
them up.

##########
File path: 
geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/commands/executor/list/LPopDUnitTest.java
##########
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal.commands.executor.list;
+
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.REDIS_CLIENT_TIMEOUT;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+
+import org.apache.geode.test.awaitility.GeodeAwaitility;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.dunit.rules.RedisClusterStartupRule;
+import org.apache.geode.test.junit.rules.ExecutorServiceRule;
+
+public class LPopDUnitTest {
+  public static final int MINIMUM_ITERATIONS = 10000;
+  private static MemberVM locator;
+
+  @ClassRule
+  public static RedisClusterStartupRule clusterStartUp = new 
RedisClusterStartupRule();
+
+  @Rule
+  public ExecutorServiceRule executor = new ExecutorServiceRule();
+
+  private static JedisCluster jedis;
+
+  @BeforeClass
+  public static void classSetup() {
+    locator = clusterStartUp.startLocatorVM(0);
+    clusterStartUp.startRedisVM(2, locator.getPort());
+    clusterStartUp.startRedisVM(3, locator.getPort());
+  }
+
+  @Before
+  public void testSetup() {
+    clusterStartUp.startRedisVM(1, locator.getPort());
+    int redisServerPort = clusterStartUp.getRedisPort(1);
+    jedis = new JedisCluster(new HostAndPort(BIND_ADDRESS, redisServerPort), 
REDIS_CLIENT_TIMEOUT);
+    clusterStartUp.flushAll();
+  }
+
+  @After
+  public void tearDown() {
+    jedis.close();
+  }
+
+  @Test
+  public void shouldDistributeDataAmongCluster_andRetainDataAfterServerCrash() 
{
+    String key = makeListKeyWithHashtag(1, 
clusterStartUp.getKeyOnServer("lpop", 1));
+    List<String> elementList = makeElementList(key, MINIMUM_ITERATIONS);
+    lpushPerformAndVerify(key, elementList);
+
+    // Remove all but last element
+    for (int i = MINIMUM_ITERATIONS - 1; i > 0; i--) {
+      assertThat(jedis.lpop(key)).isEqualTo(makeElementString(key, i));
+    }
+    clusterStartUp.crashVM(1); // kill primary server
+
+    assertThat(jedis.lpop(key)).isEqualTo(makeElementString(key, 0));
+    assertThat(jedis.exists(key)).isFalse();
+  }
+
+  @Test
+  public void givenBucketsMoveDuringLpop_thenOperationsAreNotLost() throws 
Exception {
+    AtomicLong runningCount = new AtomicLong(3);
+    List<String> listHashtags = makeListHashtags();
+    List<String> keys = makeListKeys(listHashtags);
+
+    List<String> elementList1 = makeElementList(keys.get(0), 
MINIMUM_ITERATIONS);
+    List<String> elementList2 = makeElementList(keys.get(1), 
MINIMUM_ITERATIONS);
+    List<String> elementList3 = makeElementList(keys.get(2), 
MINIMUM_ITERATIONS);
+
+    lpushPerformAndVerify(keys.get(0), elementList1);
+    lpushPerformAndVerify(keys.get(1), elementList2);
+    lpushPerformAndVerify(keys.get(2), elementList3);
+
+    Runnable task1 =
+        () -> lpopPerformAndVerify(keys.get(0), runningCount);
+    Runnable task2 =
+        () -> lpopPerformAndVerify(keys.get(1), runningCount);
+    Runnable task3 =
+        () -> lpopPerformAndVerify(keys.get(2), runningCount);
+
+    Future<Void> future1 = executor.runAsync(task1);
+    Future<Void> future2 = executor.runAsync(task2);
+    Future<Void> future3 = executor.runAsync(task3);
+
+    for (int i = 0; i < 50 && runningCount.get() > 0; i++) {
+      clusterStartUp.moveBucketForKey(listHashtags.get(i % 
listHashtags.size()));
+      GeodeAwaitility.await().during(Duration.ofMillis(500)).until(() -> true);
+    }
+
+    runningCount.set(0);
+
+    future1.get();
+    future2.get();
+    future3.get();
+  }
+
+  private List<String> makeListHashtags() {
+    List<String> listHashtags = new ArrayList<>();
+    listHashtags.add(clusterStartUp.getKeyOnServer("lpop", 1));
+    listHashtags.add(clusterStartUp.getKeyOnServer("lpop", 2));
+    listHashtags.add(clusterStartUp.getKeyOnServer("lpop", 3));
+    return listHashtags;
+  }
+
+  private List<String> makeListKeys(List<String> listHashtags) {
+    List<String> keys = new ArrayList<>();
+    keys.add(makeListKeyWithHashtag(1, listHashtags.get(0)));
+    keys.add(makeListKeyWithHashtag(2, listHashtags.get(1)));
+    keys.add(makeListKeyWithHashtag(3, listHashtags.get(2)));
+    return keys;
+  }
+
+
+  private void lpushPerformAndVerify(String key, List<String> elementList) {
+    jedis.lpush(key, elementList.toArray(new String[] {}));
+
+    Long listLength = jedis.llen(key);
+    assertThat(listLength).isEqualTo(elementList.size())
+        .as("Initial list lengths not equal for key %s'", key);

Review comment:
       Moved.

##########
File path: 
geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/commands/executor/list/LPopDUnitTest.java
##########
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal.commands.executor.list;
+
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.REDIS_CLIENT_TIMEOUT;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+
+import org.apache.geode.test.awaitility.GeodeAwaitility;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.dunit.rules.RedisClusterStartupRule;
+import org.apache.geode.test.junit.rules.ExecutorServiceRule;
+
+public class LPopDUnitTest {
+  public static final int MINIMUM_ITERATIONS = 10000;
+  private static MemberVM locator;
+
+  @ClassRule
+  public static RedisClusterStartupRule clusterStartUp = new 
RedisClusterStartupRule();
+
+  @Rule
+  public ExecutorServiceRule executor = new ExecutorServiceRule();
+
+  private static JedisCluster jedis;
+
+  @BeforeClass
+  public static void classSetup() {
+    locator = clusterStartUp.startLocatorVM(0);
+    clusterStartUp.startRedisVM(2, locator.getPort());
+    clusterStartUp.startRedisVM(3, locator.getPort());
+  }
+
+  @Before
+  public void testSetup() {
+    clusterStartUp.startRedisVM(1, locator.getPort());
+    int redisServerPort = clusterStartUp.getRedisPort(1);
+    jedis = new JedisCluster(new HostAndPort(BIND_ADDRESS, redisServerPort), 
REDIS_CLIENT_TIMEOUT);
+    clusterStartUp.flushAll();
+  }
+
+  @After
+  public void tearDown() {
+    jedis.close();
+  }
+
+  @Test
+  public void shouldDistributeDataAmongCluster_andRetainDataAfterServerCrash() 
{
+    String key = makeListKeyWithHashtag(1, 
clusterStartUp.getKeyOnServer("lpop", 1));
+    List<String> elementList = makeElementList(key, MINIMUM_ITERATIONS);
+    lpushPerformAndVerify(key, elementList);
+
+    // Remove all but last element
+    for (int i = MINIMUM_ITERATIONS - 1; i > 0; i--) {
+      assertThat(jedis.lpop(key)).isEqualTo(makeElementString(key, i));
+    }
+    clusterStartUp.crashVM(1); // kill primary server
+
+    assertThat(jedis.lpop(key)).isEqualTo(makeElementString(key, 0));
+    assertThat(jedis.exists(key)).isFalse();
+  }
+
+  @Test
+  public void givenBucketsMoveDuringLpop_thenOperationsAreNotLost() throws 
Exception {
+    AtomicLong runningCount = new AtomicLong(3);
+    List<String> listHashtags = makeListHashtags();
+    List<String> keys = makeListKeys(listHashtags);
+
+    List<String> elementList1 = makeElementList(keys.get(0), 
MINIMUM_ITERATIONS);
+    List<String> elementList2 = makeElementList(keys.get(1), 
MINIMUM_ITERATIONS);
+    List<String> elementList3 = makeElementList(keys.get(2), 
MINIMUM_ITERATIONS);

Review comment:
       Renamed. .isGreaterThanOrEqualTo() were from earlier iteration shuffling 
buckets when building lists, but that's not this test's concern.

##########
File path: 
geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/commands/executor/list/LPushDUnitTest.java
##########
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal.commands.executor.list;
+
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.REDIS_CLIENT_TIMEOUT;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+
+import org.apache.geode.test.awaitility.GeodeAwaitility;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.dunit.rules.RedisClusterStartupRule;
+import org.apache.geode.test.junit.rules.ExecutorServiceRule;
+
+public class LPushDUnitTest {
+  public static final int PUSHER_COUNT = 6;
+  public static final int PUSH_LIST_SIZE = 3;
+  private static MemberVM locator;
+
+  @ClassRule
+  public static RedisClusterStartupRule clusterStartUp = new 
RedisClusterStartupRule();
+
+  @Rule
+  public ExecutorServiceRule executor = new ExecutorServiceRule();
+
+  private static final int MINIMUM_ITERATIONS = 10000;
+  private static JedisCluster jedis;
+
+  @BeforeClass
+  public static void classSetup() {
+    locator = clusterStartUp.startLocatorVM(0);
+    clusterStartUp.startRedisVM(2, locator.getPort());
+    clusterStartUp.startRedisVM(3, locator.getPort());
+  }
+
+  @Before
+  public void testSetup() {
+    clusterStartUp.startRedisVM(1, locator.getPort());
+    clusterStartUp.rebalanceAllRegions();
+    int redisServerPort = clusterStartUp.getRedisPort(1);
+    jedis = new JedisCluster(new HostAndPort(BIND_ADDRESS, redisServerPort), 
REDIS_CLIENT_TIMEOUT);
+    clusterStartUp.flushAll();
+  }
+
+  @AfterClass
+  public static void tearDown() {
+    jedis.close();
+  }
+
+  @Test
+  public void shouldPushMultipleElementsAtomically()

Review comment:
       Renamed.

##########
File path: 
geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/commands/executor/list/LPushDUnitTest.java
##########
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal.commands.executor.list;
+
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.REDIS_CLIENT_TIMEOUT;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+
+import org.apache.geode.test.awaitility.GeodeAwaitility;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.dunit.rules.RedisClusterStartupRule;
+import org.apache.geode.test.junit.rules.ExecutorServiceRule;
+
+public class LPushDUnitTest {
+  public static final int PUSHER_COUNT = 6;
+  public static final int PUSH_LIST_SIZE = 3;
+  private static MemberVM locator;
+
+  @ClassRule
+  public static RedisClusterStartupRule clusterStartUp = new 
RedisClusterStartupRule();
+
+  @Rule
+  public ExecutorServiceRule executor = new ExecutorServiceRule();
+
+  private static final int MINIMUM_ITERATIONS = 10000;
+  private static JedisCluster jedis;
+
+  @BeforeClass
+  public static void classSetup() {
+    locator = clusterStartUp.startLocatorVM(0);
+    clusterStartUp.startRedisVM(2, locator.getPort());
+    clusterStartUp.startRedisVM(3, locator.getPort());
+  }
+
+  @Before
+  public void testSetup() {
+    clusterStartUp.startRedisVM(1, locator.getPort());
+    clusterStartUp.rebalanceAllRegions();
+    int redisServerPort = clusterStartUp.getRedisPort(1);
+    jedis = new JedisCluster(new HostAndPort(BIND_ADDRESS, redisServerPort), 
REDIS_CLIENT_TIMEOUT);
+    clusterStartUp.flushAll();
+  }
+
+  @AfterClass
+  public static void tearDown() {
+    jedis.close();
+  }
+
+  @Test
+  public void shouldPushMultipleElementsAtomically()
+      throws ExecutionException, InterruptedException {
+    AtomicLong runningCount = new AtomicLong(PUSHER_COUNT);
+
+    List<String> listHashtags = makeListHashtags();
+    List<String> keys = makeListKeys(listHashtags);
+    List<String> elements1 = makeElementList(PUSH_LIST_SIZE, "element1-");
+    List<String> elements2 = makeElementList(PUSH_LIST_SIZE, "element2-");
+    List<String> elements3 = makeElementList(PUSH_LIST_SIZE, "element3-");
+
+    List<Runnable> taskList = new ArrayList<>();
+    taskList.add(() -> lpushPerformAndVerify(keys.get(0), elements1, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(0), elements1, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(1), elements2, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(1), elements2, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(2), elements3, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(2), elements3, 
runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(0), runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(1), runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(2), runningCount));
+
+    List<Future> futureList = new ArrayList<>();

Review comment:
       Tweaked.

##########
File path: 
geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/commands/executor/list/LPushDUnitTest.java
##########
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal.commands.executor.list;
+
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.REDIS_CLIENT_TIMEOUT;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+
+import org.apache.geode.test.awaitility.GeodeAwaitility;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.dunit.rules.RedisClusterStartupRule;
+import org.apache.geode.test.junit.rules.ExecutorServiceRule;
+
+public class LPushDUnitTest {
+  public static final int PUSHER_COUNT = 6;
+  public static final int PUSH_LIST_SIZE = 3;
+  private static MemberVM locator;
+
+  @ClassRule
+  public static RedisClusterStartupRule clusterStartUp = new 
RedisClusterStartupRule();
+
+  @Rule
+  public ExecutorServiceRule executor = new ExecutorServiceRule();
+
+  private static final int MINIMUM_ITERATIONS = 10000;
+  private static JedisCluster jedis;
+
+  @BeforeClass
+  public static void classSetup() {
+    locator = clusterStartUp.startLocatorVM(0);
+    clusterStartUp.startRedisVM(2, locator.getPort());
+    clusterStartUp.startRedisVM(3, locator.getPort());
+  }
+
+  @Before
+  public void testSetup() {
+    clusterStartUp.startRedisVM(1, locator.getPort());
+    clusterStartUp.rebalanceAllRegions();
+    int redisServerPort = clusterStartUp.getRedisPort(1);
+    jedis = new JedisCluster(new HostAndPort(BIND_ADDRESS, redisServerPort), 
REDIS_CLIENT_TIMEOUT);
+    clusterStartUp.flushAll();
+  }
+
+  @AfterClass
+  public static void tearDown() {
+    jedis.close();
+  }

Review comment:
       Altered.

##########
File path: 
geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/commands/executor/list/LPushDUnitTest.java
##########
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal.commands.executor.list;
+
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.REDIS_CLIENT_TIMEOUT;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+
+import org.apache.geode.test.awaitility.GeodeAwaitility;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.dunit.rules.RedisClusterStartupRule;
+import org.apache.geode.test.junit.rules.ExecutorServiceRule;
+
+public class LPushDUnitTest {
+  public static final int PUSHER_COUNT = 6;
+  public static final int PUSH_LIST_SIZE = 3;
+  private static MemberVM locator;
+
+  @ClassRule
+  public static RedisClusterStartupRule clusterStartUp = new 
RedisClusterStartupRule();
+
+  @Rule
+  public ExecutorServiceRule executor = new ExecutorServiceRule();
+
+  private static final int MINIMUM_ITERATIONS = 10000;
+  private static JedisCluster jedis;
+
+  @BeforeClass
+  public static void classSetup() {
+    locator = clusterStartUp.startLocatorVM(0);
+    clusterStartUp.startRedisVM(2, locator.getPort());
+    clusterStartUp.startRedisVM(3, locator.getPort());
+  }
+
+  @Before
+  public void testSetup() {
+    clusterStartUp.startRedisVM(1, locator.getPort());
+    clusterStartUp.rebalanceAllRegions();
+    int redisServerPort = clusterStartUp.getRedisPort(1);
+    jedis = new JedisCluster(new HostAndPort(BIND_ADDRESS, redisServerPort), 
REDIS_CLIENT_TIMEOUT);
+    clusterStartUp.flushAll();
+  }
+
+  @AfterClass
+  public static void tearDown() {
+    jedis.close();
+  }
+
+  @Test
+  public void shouldPushMultipleElementsAtomically()
+      throws ExecutionException, InterruptedException {
+    AtomicLong runningCount = new AtomicLong(PUSHER_COUNT);
+
+    List<String> listHashtags = makeListHashtags();
+    List<String> keys = makeListKeys(listHashtags);
+    List<String> elements1 = makeElementList(PUSH_LIST_SIZE, "element1-");
+    List<String> elements2 = makeElementList(PUSH_LIST_SIZE, "element2-");
+    List<String> elements3 = makeElementList(PUSH_LIST_SIZE, "element3-");
+
+    List<Runnable> taskList = new ArrayList<>();
+    taskList.add(() -> lpushPerformAndVerify(keys.get(0), elements1, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(0), elements1, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(1), elements2, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(1), elements2, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(2), elements3, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(2), elements3, 
runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(0), runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(1), runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(2), runningCount));
+
+    List<Future> futureList = new ArrayList<>();
+    for (Runnable task : taskList) {
+      futureList.add(executor.runAsync(task));
+    }
+
+    for (int i = 0; i < 50 && runningCount.get() > 0; i++) {
+      clusterStartUp.moveBucketForKey(listHashtags.get(i % 
listHashtags.size()));
+      GeodeAwaitility.await().during(Duration.ofMillis(500)).until(() -> true);
+    }
+
+    for (Future future : futureList) {
+      future.get();
+    }
+
+    int totalLength = 0;
+    Long length;
+    for (String key : keys) {
+      length = jedis.llen(key);
+      assertThat(length).isGreaterThanOrEqualTo(MINIMUM_ITERATIONS * 2 * 
PUSH_LIST_SIZE);
+      totalLength += length;
+    }
+    assertThat(totalLength)
+        .isGreaterThanOrEqualTo(MINIMUM_ITERATIONS * PUSHER_COUNT * 
PUSH_LIST_SIZE);

Review comment:
       Removed.

##########
File path: 
geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/commands/executor/list/LPushDUnitTest.java
##########
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal.commands.executor.list;
+
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.REDIS_CLIENT_TIMEOUT;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+
+import org.apache.geode.test.awaitility.GeodeAwaitility;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.dunit.rules.RedisClusterStartupRule;
+import org.apache.geode.test.junit.rules.ExecutorServiceRule;
+
+public class LPushDUnitTest {
+  public static final int PUSHER_COUNT = 6;
+  public static final int PUSH_LIST_SIZE = 3;
+  private static MemberVM locator;
+
+  @ClassRule
+  public static RedisClusterStartupRule clusterStartUp = new 
RedisClusterStartupRule();
+
+  @Rule
+  public ExecutorServiceRule executor = new ExecutorServiceRule();
+
+  private static final int MINIMUM_ITERATIONS = 10000;
+  private static JedisCluster jedis;
+
+  @BeforeClass
+  public static void classSetup() {
+    locator = clusterStartUp.startLocatorVM(0);
+    clusterStartUp.startRedisVM(2, locator.getPort());
+    clusterStartUp.startRedisVM(3, locator.getPort());
+  }
+
+  @Before
+  public void testSetup() {
+    clusterStartUp.startRedisVM(1, locator.getPort());
+    clusterStartUp.rebalanceAllRegions();
+    int redisServerPort = clusterStartUp.getRedisPort(1);
+    jedis = new JedisCluster(new HostAndPort(BIND_ADDRESS, redisServerPort), 
REDIS_CLIENT_TIMEOUT);
+    clusterStartUp.flushAll();
+  }
+
+  @AfterClass
+  public static void tearDown() {
+    jedis.close();
+  }
+
+  @Test
+  public void shouldPushMultipleElementsAtomically()
+      throws ExecutionException, InterruptedException {
+    AtomicLong runningCount = new AtomicLong(PUSHER_COUNT);
+
+    List<String> listHashtags = makeListHashtags();
+    List<String> keys = makeListKeys(listHashtags);
+    List<String> elements1 = makeElementList(PUSH_LIST_SIZE, "element1-");
+    List<String> elements2 = makeElementList(PUSH_LIST_SIZE, "element2-");
+    List<String> elements3 = makeElementList(PUSH_LIST_SIZE, "element3-");
+
+    List<Runnable> taskList = new ArrayList<>();
+    taskList.add(() -> lpushPerformAndVerify(keys.get(0), elements1, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(0), elements1, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(1), elements2, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(1), elements2, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(2), elements3, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(2), elements3, 
runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(0), runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(1), runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(2), runningCount));
+
+    List<Future> futureList = new ArrayList<>();
+    for (Runnable task : taskList) {
+      futureList.add(executor.runAsync(task));
+    }
+
+    for (int i = 0; i < 50 && runningCount.get() > 0; i++) {
+      clusterStartUp.moveBucketForKey(listHashtags.get(i % 
listHashtags.size()));
+      GeodeAwaitility.await().during(Duration.ofMillis(500)).until(() -> true);

Review comment:
       Done.

##########
File path: 
geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/commands/executor/list/LPushDUnitTest.java
##########
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal.commands.executor.list;
+
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.REDIS_CLIENT_TIMEOUT;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+
+import org.apache.geode.test.awaitility.GeodeAwaitility;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.dunit.rules.RedisClusterStartupRule;
+import org.apache.geode.test.junit.rules.ExecutorServiceRule;
+
+public class LPushDUnitTest {
+  public static final int PUSHER_COUNT = 6;
+  public static final int PUSH_LIST_SIZE = 3;
+  private static MemberVM locator;
+
+  @ClassRule
+  public static RedisClusterStartupRule clusterStartUp = new 
RedisClusterStartupRule();
+
+  @Rule
+  public ExecutorServiceRule executor = new ExecutorServiceRule();
+
+  private static final int MINIMUM_ITERATIONS = 10000;
+  private static JedisCluster jedis;
+
+  @BeforeClass
+  public static void classSetup() {
+    locator = clusterStartUp.startLocatorVM(0);
+    clusterStartUp.startRedisVM(2, locator.getPort());
+    clusterStartUp.startRedisVM(3, locator.getPort());
+  }
+
+  @Before
+  public void testSetup() {
+    clusterStartUp.startRedisVM(1, locator.getPort());
+    clusterStartUp.rebalanceAllRegions();
+    int redisServerPort = clusterStartUp.getRedisPort(1);
+    jedis = new JedisCluster(new HostAndPort(BIND_ADDRESS, redisServerPort), 
REDIS_CLIENT_TIMEOUT);
+    clusterStartUp.flushAll();
+  }
+
+  @AfterClass
+  public static void tearDown() {
+    jedis.close();
+  }
+
+  @Test
+  public void shouldPushMultipleElementsAtomically()
+      throws ExecutionException, InterruptedException {
+    AtomicLong runningCount = new AtomicLong(PUSHER_COUNT);
+
+    List<String> listHashtags = makeListHashtags();
+    List<String> keys = makeListKeys(listHashtags);
+    List<String> elements1 = makeElementList(PUSH_LIST_SIZE, "element1-");
+    List<String> elements2 = makeElementList(PUSH_LIST_SIZE, "element2-");
+    List<String> elements3 = makeElementList(PUSH_LIST_SIZE, "element3-");
+
+    List<Runnable> taskList = new ArrayList<>();
+    taskList.add(() -> lpushPerformAndVerify(keys.get(0), elements1, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(0), elements1, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(1), elements2, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(1), elements2, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(2), elements3, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(2), elements3, 
runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(0), runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(1), runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(2), runningCount));
+
+    List<Future> futureList = new ArrayList<>();
+    for (Runnable task : taskList) {
+      futureList.add(executor.runAsync(task));
+    }
+
+    for (int i = 0; i < 50 && runningCount.get() > 0; i++) {
+      clusterStartUp.moveBucketForKey(listHashtags.get(i % 
listHashtags.size()));
+      GeodeAwaitility.await().during(Duration.ofMillis(500)).until(() -> true);
+    }
+
+    for (Future future : futureList) {
+      future.get();
+    }
+
+    int totalLength = 0;
+    Long length;
+    for (String key : keys) {
+      length = jedis.llen(key);
+      assertThat(length).isGreaterThanOrEqualTo(MINIMUM_ITERATIONS * 2 * 
PUSH_LIST_SIZE);
+      totalLength += length;
+    }

Review comment:
       Without something like LINDEX that kind of validation can only be done 
destructively. There absolutely is a failure mode where only part of a list 
gets added if it's not handled atomically. We can add a ticket to update these 
with a LINDEX.

##########
File path: 
geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/commands/executor/list/LPushDUnitTest.java
##########
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal.commands.executor.list;
+
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.REDIS_CLIENT_TIMEOUT;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+
+import org.apache.geode.test.awaitility.GeodeAwaitility;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.dunit.rules.RedisClusterStartupRule;
+import org.apache.geode.test.junit.rules.ExecutorServiceRule;
+
+public class LPushDUnitTest {
+  public static final int PUSHER_COUNT = 6;
+  public static final int PUSH_LIST_SIZE = 3;
+  private static MemberVM locator;
+
+  @ClassRule
+  public static RedisClusterStartupRule clusterStartUp = new 
RedisClusterStartupRule();
+
+  @Rule
+  public ExecutorServiceRule executor = new ExecutorServiceRule();
+
+  private static final int MINIMUM_ITERATIONS = 10000;
+  private static JedisCluster jedis;
+
+  @BeforeClass
+  public static void classSetup() {
+    locator = clusterStartUp.startLocatorVM(0);
+    clusterStartUp.startRedisVM(2, locator.getPort());
+    clusterStartUp.startRedisVM(3, locator.getPort());
+  }
+
+  @Before
+  public void testSetup() {
+    clusterStartUp.startRedisVM(1, locator.getPort());
+    clusterStartUp.rebalanceAllRegions();
+    int redisServerPort = clusterStartUp.getRedisPort(1);
+    jedis = new JedisCluster(new HostAndPort(BIND_ADDRESS, redisServerPort), 
REDIS_CLIENT_TIMEOUT);
+    clusterStartUp.flushAll();
+  }
+
+  @AfterClass
+  public static void tearDown() {
+    jedis.close();
+  }
+
+  @Test
+  public void shouldPushMultipleElementsAtomically()
+      throws ExecutionException, InterruptedException {
+    AtomicLong runningCount = new AtomicLong(PUSHER_COUNT);
+
+    List<String> listHashtags = makeListHashtags();
+    List<String> keys = makeListKeys(listHashtags);
+    List<String> elements1 = makeElementList(PUSH_LIST_SIZE, "element1-");
+    List<String> elements2 = makeElementList(PUSH_LIST_SIZE, "element2-");
+    List<String> elements3 = makeElementList(PUSH_LIST_SIZE, "element3-");
+
+    List<Runnable> taskList = new ArrayList<>();
+    taskList.add(() -> lpushPerformAndVerify(keys.get(0), elements1, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(0), elements1, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(1), elements2, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(1), elements2, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(2), elements3, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(2), elements3, 
runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(0), runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(1), runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(2), runningCount));
+
+    List<Future> futureList = new ArrayList<>();
+    for (Runnable task : taskList) {
+      futureList.add(executor.runAsync(task));
+    }
+
+    for (int i = 0; i < 50 && runningCount.get() > 0; i++) {
+      clusterStartUp.moveBucketForKey(listHashtags.get(i % 
listHashtags.size()));
+      GeodeAwaitility.await().during(Duration.ofMillis(500)).until(() -> true);
+    }
+
+    for (Future future : futureList) {
+      future.get();
+    }
+
+    int totalLength = 0;
+    Long length;
+    for (String key : keys) {
+      length = jedis.llen(key);
+      assertThat(length).isGreaterThanOrEqualTo(MINIMUM_ITERATIONS * 2 * 
PUSH_LIST_SIZE);
+      totalLength += length;
+    }
+    assertThat(totalLength)
+        .isGreaterThanOrEqualTo(MINIMUM_ITERATIONS * PUSHER_COUNT * 
PUSH_LIST_SIZE);
+    clusterStartUp.crashVM(1); // kill primary server, just in case test order 
is reversed
+  }
+
+  private void lpushPerformAndVerify(String key, List<String> elementList,
+      AtomicLong runningCount) {
+    for (int i = 0; i < MINIMUM_ITERATIONS; i++) {
+      long listLength = jedis.llen(key);
+      long newLength = jedis.lpush(key, elementList.toArray(new String[] {}));
+      assertThat((newLength - listLength) % 3).as("LPUSH, list length %s not 
multiple of 3",
+          newLength).isEqualTo(0);
+    }
+    runningCount.decrementAndGet();
+  }
+
+  @Test
+  public void shouldDistributeElementsAcrossCluster()

Review comment:
       Renamed.

##########
File path: 
geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/commands/executor/list/LPushDUnitTest.java
##########
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal.commands.executor.list;
+
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.REDIS_CLIENT_TIMEOUT;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+
+import org.apache.geode.test.awaitility.GeodeAwaitility;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.dunit.rules.RedisClusterStartupRule;
+import org.apache.geode.test.junit.rules.ExecutorServiceRule;
+
+public class LPushDUnitTest {
+  public static final int PUSHER_COUNT = 6;
+  public static final int PUSH_LIST_SIZE = 3;
+  private static MemberVM locator;
+
+  @ClassRule
+  public static RedisClusterStartupRule clusterStartUp = new 
RedisClusterStartupRule();
+
+  @Rule
+  public ExecutorServiceRule executor = new ExecutorServiceRule();
+
+  private static final int MINIMUM_ITERATIONS = 10000;
+  private static JedisCluster jedis;
+
+  @BeforeClass
+  public static void classSetup() {
+    locator = clusterStartUp.startLocatorVM(0);
+    clusterStartUp.startRedisVM(2, locator.getPort());
+    clusterStartUp.startRedisVM(3, locator.getPort());
+  }
+
+  @Before
+  public void testSetup() {
+    clusterStartUp.startRedisVM(1, locator.getPort());
+    clusterStartUp.rebalanceAllRegions();
+    int redisServerPort = clusterStartUp.getRedisPort(1);
+    jedis = new JedisCluster(new HostAndPort(BIND_ADDRESS, redisServerPort), 
REDIS_CLIENT_TIMEOUT);
+    clusterStartUp.flushAll();
+  }
+
+  @AfterClass
+  public static void tearDown() {
+    jedis.close();
+  }
+
+  @Test
+  public void shouldPushMultipleElementsAtomically()
+      throws ExecutionException, InterruptedException {
+    AtomicLong runningCount = new AtomicLong(PUSHER_COUNT);
+
+    List<String> listHashtags = makeListHashtags();
+    List<String> keys = makeListKeys(listHashtags);
+    List<String> elements1 = makeElementList(PUSH_LIST_SIZE, "element1-");
+    List<String> elements2 = makeElementList(PUSH_LIST_SIZE, "element2-");
+    List<String> elements3 = makeElementList(PUSH_LIST_SIZE, "element3-");
+
+    List<Runnable> taskList = new ArrayList<>();
+    taskList.add(() -> lpushPerformAndVerify(keys.get(0), elements1, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(0), elements1, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(1), elements2, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(1), elements2, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(2), elements3, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(2), elements3, 
runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(0), runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(1), runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(2), runningCount));
+
+    List<Future> futureList = new ArrayList<>();
+    for (Runnable task : taskList) {
+      futureList.add(executor.runAsync(task));
+    }
+
+    for (int i = 0; i < 50 && runningCount.get() > 0; i++) {
+      clusterStartUp.moveBucketForKey(listHashtags.get(i % 
listHashtags.size()));
+      GeodeAwaitility.await().during(Duration.ofMillis(500)).until(() -> true);
+    }
+
+    for (Future future : futureList) {
+      future.get();
+    }
+
+    int totalLength = 0;
+    Long length;
+    for (String key : keys) {
+      length = jedis.llen(key);
+      assertThat(length).isGreaterThanOrEqualTo(MINIMUM_ITERATIONS * 2 * 
PUSH_LIST_SIZE);
+      totalLength += length;
+    }
+    assertThat(totalLength)
+        .isGreaterThanOrEqualTo(MINIMUM_ITERATIONS * PUSHER_COUNT * 
PUSH_LIST_SIZE);
+    clusterStartUp.crashVM(1); // kill primary server, just in case test order 
is reversed
+  }
+
+  private void lpushPerformAndVerify(String key, List<String> elementList,
+      AtomicLong runningCount) {
+    for (int i = 0; i < MINIMUM_ITERATIONS; i++) {
+      long listLength = jedis.llen(key);
+      long newLength = jedis.lpush(key, elementList.toArray(new String[] {}));
+      assertThat((newLength - listLength) % 3).as("LPUSH, list length %s not 
multiple of 3",
+          newLength).isEqualTo(0);
+    }
+    runningCount.decrementAndGet();
+  }
+
+  @Test
+  public void shouldDistributeElementsAcrossCluster()
+      throws ExecutionException, InterruptedException {
+    final int pusherCount = 6;
+    final int pushListSize = 3;
+    AtomicLong runningCount = new AtomicLong(pusherCount);
+
+    List<String> listHashtags = makeListHashtags();
+    List<String> keys = makeListKeys(listHashtags);
+    List<String> elements1 = makeElementList(pushListSize, "element1-");
+    List<String> elements2 = makeElementList(pushListSize, "element2-");
+    List<String> elements3 = makeElementList(pushListSize, "element2-");
+
+    List<Runnable> taskList = new ArrayList<>();
+    taskList.add(() -> lpushPerformAndVerify(keys.get(0), elements1, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(0), elements1, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(1), elements2, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(1), elements2, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(2), elements3, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(2), elements3, 
runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(0), runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(1), runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(2), runningCount));
+
+    List<Future> futureList = new ArrayList<>();
+    for (Runnable task : taskList) {
+      futureList.add(executor.runAsync(task));
+    }
+
+    GeodeAwaitility.await().during(Duration.ofMillis(200)).until(() -> true);

Review comment:
       All right, we'll need to fix it in StringsDUnitTest and RenameDUnitTest 
as well.

##########
File path: 
geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/commands/executor/list/LPushDUnitTest.java
##########
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal.commands.executor.list;
+
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.BIND_ADDRESS;
+import static 
org.apache.geode.test.dunit.rules.RedisClusterStartupRule.REDIS_CLIENT_TIMEOUT;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+
+import org.apache.geode.test.awaitility.GeodeAwaitility;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.dunit.rules.RedisClusterStartupRule;
+import org.apache.geode.test.junit.rules.ExecutorServiceRule;
+
+public class LPushDUnitTest {
+  public static final int PUSHER_COUNT = 6;
+  public static final int PUSH_LIST_SIZE = 3;
+  private static MemberVM locator;
+
+  @ClassRule
+  public static RedisClusterStartupRule clusterStartUp = new 
RedisClusterStartupRule();
+
+  @Rule
+  public ExecutorServiceRule executor = new ExecutorServiceRule();
+
+  private static final int MINIMUM_ITERATIONS = 10000;
+  private static JedisCluster jedis;
+
+  @BeforeClass
+  public static void classSetup() {
+    locator = clusterStartUp.startLocatorVM(0);
+    clusterStartUp.startRedisVM(2, locator.getPort());
+    clusterStartUp.startRedisVM(3, locator.getPort());
+  }
+
+  @Before
+  public void testSetup() {
+    clusterStartUp.startRedisVM(1, locator.getPort());
+    clusterStartUp.rebalanceAllRegions();
+    int redisServerPort = clusterStartUp.getRedisPort(1);
+    jedis = new JedisCluster(new HostAndPort(BIND_ADDRESS, redisServerPort), 
REDIS_CLIENT_TIMEOUT);
+    clusterStartUp.flushAll();
+  }
+
+  @AfterClass
+  public static void tearDown() {
+    jedis.close();
+  }
+
+  @Test
+  public void shouldPushMultipleElementsAtomically()
+      throws ExecutionException, InterruptedException {
+    AtomicLong runningCount = new AtomicLong(PUSHER_COUNT);
+
+    List<String> listHashtags = makeListHashtags();
+    List<String> keys = makeListKeys(listHashtags);
+    List<String> elements1 = makeElementList(PUSH_LIST_SIZE, "element1-");
+    List<String> elements2 = makeElementList(PUSH_LIST_SIZE, "element2-");
+    List<String> elements3 = makeElementList(PUSH_LIST_SIZE, "element3-");
+
+    List<Runnable> taskList = new ArrayList<>();
+    taskList.add(() -> lpushPerformAndVerify(keys.get(0), elements1, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(0), elements1, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(1), elements2, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(1), elements2, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(2), elements3, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(2), elements3, 
runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(0), runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(1), runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(2), runningCount));
+
+    List<Future> futureList = new ArrayList<>();
+    for (Runnable task : taskList) {
+      futureList.add(executor.runAsync(task));
+    }
+
+    for (int i = 0; i < 50 && runningCount.get() > 0; i++) {
+      clusterStartUp.moveBucketForKey(listHashtags.get(i % 
listHashtags.size()));
+      GeodeAwaitility.await().during(Duration.ofMillis(500)).until(() -> true);
+    }
+
+    for (Future future : futureList) {
+      future.get();
+    }
+
+    int totalLength = 0;
+    Long length;
+    for (String key : keys) {
+      length = jedis.llen(key);
+      assertThat(length).isGreaterThanOrEqualTo(MINIMUM_ITERATIONS * 2 * 
PUSH_LIST_SIZE);
+      totalLength += length;
+    }
+    assertThat(totalLength)
+        .isGreaterThanOrEqualTo(MINIMUM_ITERATIONS * PUSHER_COUNT * 
PUSH_LIST_SIZE);
+    clusterStartUp.crashVM(1); // kill primary server, just in case test order 
is reversed
+  }
+
+  private void lpushPerformAndVerify(String key, List<String> elementList,
+      AtomicLong runningCount) {
+    for (int i = 0; i < MINIMUM_ITERATIONS; i++) {
+      long listLength = jedis.llen(key);
+      long newLength = jedis.lpush(key, elementList.toArray(new String[] {}));
+      assertThat((newLength - listLength) % 3).as("LPUSH, list length %s not 
multiple of 3",
+          newLength).isEqualTo(0);
+    }
+    runningCount.decrementAndGet();
+  }
+
+  @Test
+  public void shouldDistributeElementsAcrossCluster()
+      throws ExecutionException, InterruptedException {
+    final int pusherCount = 6;
+    final int pushListSize = 3;
+    AtomicLong runningCount = new AtomicLong(pusherCount);
+
+    List<String> listHashtags = makeListHashtags();
+    List<String> keys = makeListKeys(listHashtags);
+    List<String> elements1 = makeElementList(pushListSize, "element1-");
+    List<String> elements2 = makeElementList(pushListSize, "element2-");
+    List<String> elements3 = makeElementList(pushListSize, "element2-");
+
+    List<Runnable> taskList = new ArrayList<>();
+    taskList.add(() -> lpushPerformAndVerify(keys.get(0), elements1, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(0), elements1, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(1), elements2, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(1), elements2, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(2), elements3, 
runningCount));
+    taskList.add(() -> lpushPerformAndVerify(keys.get(2), elements3, 
runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(0), runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(1), runningCount));
+    taskList.add(() -> verifyListLengthCondition(keys.get(2), runningCount));
+
+    List<Future> futureList = new ArrayList<>();
+    for (Runnable task : taskList) {
+      futureList.add(executor.runAsync(task));
+    }
+
+    GeodeAwaitility.await().during(Duration.ofMillis(200)).until(() -> true);
+    clusterStartUp.crashVM(1); // kill primary server
+
+    for (Future future : futureList) {
+      future.get();
+    }
+
+    Long length;
+    for (String key : keys) {
+      length = jedis.llen(key);
+      assertThat(length).isGreaterThanOrEqualTo(MINIMUM_ITERATIONS * 2 * 
pushListSize);
+      assertThat(length % 3).isEqualTo(0);
+    }

Review comment:
       Soon as we have LINDEX we can do that non-destructively.




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to