ringles commented on a change in pull request #7403: URL: https://github.com/apache/geode/pull/7403#discussion_r839845341
########## File path: geode-for-redis/src/main/java/org/apache/geode/redis/internal/data/collections/SizeableByteArrayList.java ########## @@ -83,6 +83,39 @@ return indexesRemoved; } + public void clearSublist(int fromIndex, int toIndex) { Review comment: GEODE-10204 created. ########## File path: geode-for-redis/src/test/java/org/apache/geode/redis/internal/data/collections/SizeableByteArrayListTest.java ########## @@ -58,6 +58,24 @@ public void getSizeInBytesIsAccurate_ForSizeableByteArrayListElements() { assertThat(list.size()).isEqualTo(0); } + @Test + public void clearSublist_getSizeInBytesIsAccurate() { + // Create a list with an initial size and confirm that it correctly reports its size + SizeableByteArrayList list = createList(); + assertThat(list.getSizeInBytes()).isEqualTo(sizer.sizeof(list)); + + // Remove subset of elements and assert that the size is correct after each remove + Random rand = new Random(); + while (list.size() > 3) { + int fromIndex = rand.nextInt(list.size() / 2); + int toIndex = rand.nextInt(list.size() / 2) + fromIndex; Review comment: Deterministic now. ########## File path: geode-for-redis/src/integrationTest/java/org/apache/geode/redis/internal/commands/executor/list/AbstractLTrimIntegrationTest.java ########## @@ -0,0 +1,160 @@ +/* + * 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.assertExactNumberOfArgs; +import static org.apache.geode.redis.internal.RedisConstants.ERROR_NOT_INTEGER; +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.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.atomic.AtomicReference; + +import junitparams.Parameters; +import junitparams.naming.TestCaseName; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +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; +import org.apache.geode.test.junit.runners.GeodeParamsRunner; + +@RunWith(GeodeParamsRunner.class) +public abstract class AbstractLTrimIntegrationTest implements RedisIntegrationTest { Review comment: Can you think of more cases to add to the new trimsToSpecifiedRange_givenListWithOneElement() test? -- 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: notifications-unsubscr...@geode.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org