[jira] [Commented] (GEODE-8867) Unit/Integration/multi-node concurrency (Dunit) tests for **HLEN** command
[ https://issues.apache.org/jira/browse/GEODE-8867?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17272438#comment-17272438 ] ASF GitHub Bot commented on GEODE-8867: --- nonbinaryprogrammer opened a new pull request #5955: URL: https://github.com/apache/geode/pull/5955 - add unit/integration tests - fix up a couple of other unit/integration tests - add Dunit tests for hlen concurrency - update docs for HLEN - update supportedCommandsJUnitTest for HLEN - update docs and supportedCommandsJUnitTest for a few other commands we forgot about before Signed-off-by: Ray Ingles Thank you for submitting a contribution to Apache Geode. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [ ] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [ ] Has your PR been rebased against the latest commit within the target branch (typically `develop`)? - [ ] Is your initial contribution a single, squashed commit? - [ ] Does `gradlew build` run cleanly? - [ ] Have you written or updated unit tests to verify your changes? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? ### Note: Please ensure that once the PR is submitted, check Concourse for build issues and submit an update to your PR as soon as possible. If you need help, please send an email to d...@geode.apache.org. 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 > Unit/Integration/multi-node concurrency (Dunit) tests for **HLEN** command > -- > > Key: GEODE-8867 > URL: https://issues.apache.org/jira/browse/GEODE-8867 > Project: Geode > Issue Type: Test > Components: redis >Reporter: Helena Bales >Assignee: Helena Bales >Priority: Major > > Write unit and integration tests. > Write dunit tests, to launch multi-node clusters, which test multiple > concurrent clients accessing different servers for the following command: > HLEN > A.C. > Tests are passing, and README/redis_api_for_geode.html.md.erb updated to > make command "supported", or > Stories in the backlog to fix the identified issues (with JIRA tickets) > and problem tests ignored -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (GEODE-8867) Unit/Integration/multi-node concurrency (Dunit) tests for **HLEN** command
[ https://issues.apache.org/jira/browse/GEODE-8867?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17272930#comment-17272930 ] ASF GitHub Bot commented on GEODE-8867: --- sabbey37 commented on a change in pull request #5955: URL: https://github.com/apache/geode/pull/5955#discussion_r565388281 ## File path: geode-redis/src/distributedTest/java/org/apache/geode/redis/internal/executor/hash/HlenDUnitTest.java ## @@ -0,0 +1,169 @@ +/* + * 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.executor.hash; + +import static org.apache.geode.distributed.ConfigurationProperties.REDIS_PORT; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; + +import io.lettuce.core.ClientOptions; +import io.lettuce.core.RedisClient; +import io.lettuce.core.api.StatefulRedisConnection; +import io.lettuce.core.api.sync.RedisCommands; +import io.lettuce.core.resource.ClientResources; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; + +import org.apache.geode.internal.AvailablePortHelper; +import org.apache.geode.redis.ConcurrentLoopingThreads; +import org.apache.geode.redis.session.springRedisTestApplication.config.DUnitSocketAddressResolver; +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 HlenDUnitTest { + + @ClassRule + public static RedisClusterStartupRule cluster = new RedisClusterStartupRule(); + + @ClassRule + public static ExecutorServiceRule executor = new ExecutorServiceRule(); + + private static final int HASH_SIZE = 5000; + private static final int NUM_ITERATIONS = 5; + private static MemberVM locator; + private static MemberVM server1; + private static MemberVM server2; + private static int[] redisPorts; + private static RedisCommands lettuce; + private static StatefulRedisConnection connection; + private static ClientResources resources; + + @BeforeClass + public static void classSetup() { +redisPorts = AvailablePortHelper.getRandomAvailableTCPPorts(3); + +String redisPort1 = String.valueOf(redisPorts[0]); +String redisPort2 = String.valueOf(redisPorts[1]); + +locator = cluster.startLocatorVM(0); + +server1 = startRedisVM(1, redisPorts[0]); +server2 = startRedisVM(2, redisPorts[1]); + +DUnitSocketAddressResolver dnsResolver = +new DUnitSocketAddressResolver(new String[] {redisPort2, redisPort1}); + +resources = ClientResources.builder().socketAddressResolver(dnsResolver).build(); + +RedisClient redisClient = RedisClient.create(resources, "redis://localhost"); + redisClient.setOptions(ClientOptions.builder().autoReconnect(true).build()); + +connection = redisClient.connect(); +lettuce = connection.sync(); + } + + private static MemberVM startRedisVM(int vmID, int redisPort) { +int locatorPort = locator.getPort(); + +return cluster.startRedisVM(vmID, (x) -> x +.withConnectionToLocator(locatorPort) +.withProperty(REDIS_PORT, "" + redisPort)); + } + + @Before + public void testSetup() { +lettuce.flushall(); + } + + @AfterClass + public static void tearDown() throws Exception { +resources.shutdown().get(); +connection.close(); + +server1.stop(); +server2.stop(); + } + + @Test + public void testConcurrentHLens_returnExpectedLength() { +AtomicLong client1Len = new AtomicLong(); +AtomicLong client2Len = new AtomicLong(); + +String key = "HLEN"; + +Map setUpData = makeInitialHashMap(HASH_SIZE, "field", "value"); + +lettuce.hset(key, setUpData); + +new ConcurrentLoopingThreads(NUM_ITERATIONS, +i -> { + long len = lettuce.hlen(key); + client1Len.addAndGet(len); +}, +i -> { + long len = lettuce.hlen(key); + client2Len.addAndGet(len); +}) +.run(); + +assertThat(client1Len
[jira] [Commented] (GEODE-8867) Unit/Integration/multi-node concurrency (Dunit) tests for **HLEN** command
[ https://issues.apache.org/jira/browse/GEODE-8867?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17273021#comment-17273021 ] ASF GitHub Bot commented on GEODE-8867: --- nonbinaryprogrammer commented on a change in pull request #5955: URL: https://github.com/apache/geode/pull/5955#discussion_r565491582 ## File path: geode-redis/src/distributedTest/java/org/apache/geode/redis/internal/executor/hash/HlenDUnitTest.java ## @@ -0,0 +1,169 @@ +/* + * 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.executor.hash; + +import static org.apache.geode.distributed.ConfigurationProperties.REDIS_PORT; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; + +import io.lettuce.core.ClientOptions; +import io.lettuce.core.RedisClient; +import io.lettuce.core.api.StatefulRedisConnection; +import io.lettuce.core.api.sync.RedisCommands; +import io.lettuce.core.resource.ClientResources; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; + +import org.apache.geode.internal.AvailablePortHelper; +import org.apache.geode.redis.ConcurrentLoopingThreads; +import org.apache.geode.redis.session.springRedisTestApplication.config.DUnitSocketAddressResolver; +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 HlenDUnitTest { + + @ClassRule + public static RedisClusterStartupRule cluster = new RedisClusterStartupRule(); + + @ClassRule + public static ExecutorServiceRule executor = new ExecutorServiceRule(); + + private static final int HASH_SIZE = 5000; + private static final int NUM_ITERATIONS = 5; + private static MemberVM locator; + private static MemberVM server1; + private static MemberVM server2; + private static int[] redisPorts; + private static RedisCommands lettuce; + private static StatefulRedisConnection connection; + private static ClientResources resources; + + @BeforeClass + public static void classSetup() { +redisPorts = AvailablePortHelper.getRandomAvailableTCPPorts(3); + +String redisPort1 = String.valueOf(redisPorts[0]); +String redisPort2 = String.valueOf(redisPorts[1]); + +locator = cluster.startLocatorVM(0); + +server1 = startRedisVM(1, redisPorts[0]); +server2 = startRedisVM(2, redisPorts[1]); + +DUnitSocketAddressResolver dnsResolver = +new DUnitSocketAddressResolver(new String[] {redisPort2, redisPort1}); + +resources = ClientResources.builder().socketAddressResolver(dnsResolver).build(); + +RedisClient redisClient = RedisClient.create(resources, "redis://localhost"); + redisClient.setOptions(ClientOptions.builder().autoReconnect(true).build()); + +connection = redisClient.connect(); +lettuce = connection.sync(); + } + + private static MemberVM startRedisVM(int vmID, int redisPort) { +int locatorPort = locator.getPort(); + +return cluster.startRedisVM(vmID, (x) -> x +.withConnectionToLocator(locatorPort) +.withProperty(REDIS_PORT, "" + redisPort)); + } + + @Before + public void testSetup() { +lettuce.flushall(); + } + + @AfterClass + public static void tearDown() throws Exception { +resources.shutdown().get(); +connection.close(); + +server1.stop(); +server2.stop(); + } + + @Test + public void testConcurrentHLens_returnExpectedLength() { +AtomicLong client1Len = new AtomicLong(); +AtomicLong client2Len = new AtomicLong(); + +String key = "HLEN"; + +Map setUpData = makeInitialHashMap(HASH_SIZE, "field", "value"); + +lettuce.hset(key, setUpData); + +new ConcurrentLoopingThreads(NUM_ITERATIONS, +i -> { + long len = lettuce.hlen(key); + client1Len.addAndGet(len); +}, +i -> { + long len = lettuce.hlen(key); + client2Len.addAndGet(len); +}) +.run(); + +assertThat
[jira] [Commented] (GEODE-8867) Unit/Integration/multi-node concurrency (Dunit) tests for **HLEN** command
[ https://issues.apache.org/jira/browse/GEODE-8867?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17273022#comment-17273022 ] ASF GitHub Bot commented on GEODE-8867: --- nonbinaryprogrammer commented on a change in pull request #5955: URL: https://github.com/apache/geode/pull/5955#discussion_r565491985 ## File path: geode-redis/src/test/java/org/apache/geode/redis/internal/SupportedCommandsJUnitTest.java ## @@ -41,6 +41,10 @@ "HMSET", "HSET", "HSETNX", + "HVALS", Review comment: this was the CI failure that confused me. it took a minute to figure out what was going on 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 > Unit/Integration/multi-node concurrency (Dunit) tests for **HLEN** command > -- > > Key: GEODE-8867 > URL: https://issues.apache.org/jira/browse/GEODE-8867 > Project: Geode > Issue Type: Test > Components: redis >Reporter: Helena Bales >Assignee: Helena Bales >Priority: Major > Labels: pull-request-available > > Write unit and integration tests. > Write dunit tests, to launch multi-node clusters, which test multiple > concurrent clients accessing different servers for the following command: > HLEN > A.C. > Tests are passing, and README/redis_api_for_geode.html.md.erb updated to > make command "supported", or > Stories in the backlog to fix the identified issues (with JIRA tickets) > and problem tests ignored -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (GEODE-8867) Unit/Integration/multi-node concurrency (Dunit) tests for **HLEN** command
[ https://issues.apache.org/jira/browse/GEODE-8867?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17273023#comment-17273023 ] ASF GitHub Bot commented on GEODE-8867: --- nonbinaryprogrammer commented on a change in pull request #5955: URL: https://github.com/apache/geode/pull/5955#discussion_r565492510 ## File path: geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHashesIntegrationTest.java ## @@ -540,6 +540,22 @@ public void testHLen() { } + @Test + public void testHLenErrorMessage_givenIncorrectDataType() { +jedis.set("farm", "chicken"); +assertThatThrownBy(() -> jedis.hlen("farm")) +.isInstanceOf(JedisDataException.class) +.hasMessageContaining("WRONGTYPE Operation against a key holding the wrong kind of value"); + } + + @Test + public void testHLen_givenWrongNumberOfArguments() { +assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HLEN)) +.hasMessageContaining("wrong number of arguments"); +assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HLEN, "1", "2")) +.hasMessageContaining("wrong number of arguments"); Review comment: thanks! I thought I had changed them all in a previous commit but that was on a different branch. good catch 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 > Unit/Integration/multi-node concurrency (Dunit) tests for **HLEN** command > -- > > Key: GEODE-8867 > URL: https://issues.apache.org/jira/browse/GEODE-8867 > Project: Geode > Issue Type: Test > Components: redis >Reporter: Helena Bales >Assignee: Helena Bales >Priority: Major > Labels: pull-request-available > > Write unit and integration tests. > Write dunit tests, to launch multi-node clusters, which test multiple > concurrent clients accessing different servers for the following command: > HLEN > A.C. > Tests are passing, and README/redis_api_for_geode.html.md.erb updated to > make command "supported", or > Stories in the backlog to fix the identified issues (with JIRA tickets) > and problem tests ignored -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (GEODE-8867) Unit/Integration/multi-node concurrency (Dunit) tests for **HLEN** command
[ https://issues.apache.org/jira/browse/GEODE-8867?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17273025#comment-17273025 ] ASF GitHub Bot commented on GEODE-8867: --- nonbinaryprogrammer commented on a change in pull request #5955: URL: https://github.com/apache/geode/pull/5955#discussion_r565493726 ## File path: geode-redis/src/distributedTest/java/org/apache/geode/redis/internal/executor/hash/HlenDUnitTest.java ## @@ -0,0 +1,169 @@ +/* + * 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.executor.hash; + +import static org.apache.geode.distributed.ConfigurationProperties.REDIS_PORT; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; + +import io.lettuce.core.ClientOptions; +import io.lettuce.core.RedisClient; +import io.lettuce.core.api.StatefulRedisConnection; +import io.lettuce.core.api.sync.RedisCommands; +import io.lettuce.core.resource.ClientResources; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; + +import org.apache.geode.internal.AvailablePortHelper; +import org.apache.geode.redis.ConcurrentLoopingThreads; +import org.apache.geode.redis.session.springRedisTestApplication.config.DUnitSocketAddressResolver; +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 HlenDUnitTest { + + @ClassRule + public static RedisClusterStartupRule cluster = new RedisClusterStartupRule(); + + @ClassRule + public static ExecutorServiceRule executor = new ExecutorServiceRule(); + + private static final int HASH_SIZE = 5000; + private static final int NUM_ITERATIONS = 5; + private static MemberVM locator; + private static MemberVM server1; + private static MemberVM server2; + private static int[] redisPorts; + private static RedisCommands lettuce; + private static StatefulRedisConnection connection; + private static ClientResources resources; + + @BeforeClass + public static void classSetup() { +redisPorts = AvailablePortHelper.getRandomAvailableTCPPorts(3); + +String redisPort1 = String.valueOf(redisPorts[0]); +String redisPort2 = String.valueOf(redisPorts[1]); + +locator = cluster.startLocatorVM(0); + +server1 = startRedisVM(1, redisPorts[0]); +server2 = startRedisVM(2, redisPorts[1]); + +DUnitSocketAddressResolver dnsResolver = +new DUnitSocketAddressResolver(new String[] {redisPort2, redisPort1}); + +resources = ClientResources.builder().socketAddressResolver(dnsResolver).build(); + +RedisClient redisClient = RedisClient.create(resources, "redis://localhost"); + redisClient.setOptions(ClientOptions.builder().autoReconnect(true).build()); + +connection = redisClient.connect(); +lettuce = connection.sync(); + } + + private static MemberVM startRedisVM(int vmID, int redisPort) { +int locatorPort = locator.getPort(); + +return cluster.startRedisVM(vmID, (x) -> x +.withConnectionToLocator(locatorPort) +.withProperty(REDIS_PORT, "" + redisPort)); + } + + @Before + public void testSetup() { +lettuce.flushall(); + } + + @AfterClass + public static void tearDown() throws Exception { +resources.shutdown().get(); +connection.close(); + +server1.stop(); +server2.stop(); + } + + @Test + public void testConcurrentHLens_returnExpectedLength() { +AtomicLong client1Len = new AtomicLong(); +AtomicLong client2Len = new AtomicLong(); + +String key = "HLEN"; + +Map setUpData = makeInitialHashMap(HASH_SIZE, "field", "value"); + +lettuce.hset(key, setUpData); + +new ConcurrentLoopingThreads(NUM_ITERATIONS, +i -> { + long len = lettuce.hlen(key); + client1Len.addAndGet(len); +}, +i -> { + long len = lettuce.hlen(key); + client2Len.addAndGet(len); +}) +.run(); + +assertThat
[jira] [Commented] (GEODE-8867) Unit/Integration/multi-node concurrency (Dunit) tests for **HLEN** command
[ https://issues.apache.org/jira/browse/GEODE-8867?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17273044#comment-17273044 ] ASF GitHub Bot commented on GEODE-8867: --- sabbey37 commented on a change in pull request #5955: URL: https://github.com/apache/geode/pull/5955#discussion_r565504360 ## File path: geode-redis/src/distributedTest/java/org/apache/geode/redis/internal/executor/hash/HlenDUnitTest.java ## @@ -0,0 +1,170 @@ +/* + * 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.executor.hash; + +import static org.apache.geode.distributed.ConfigurationProperties.REDIS_PORT; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; + +import io.lettuce.core.ClientOptions; +import io.lettuce.core.RedisClient; +import io.lettuce.core.api.StatefulRedisConnection; +import io.lettuce.core.api.sync.RedisCommands; +import io.lettuce.core.resource.ClientResources; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; + +import org.apache.geode.internal.AvailablePortHelper; +import org.apache.geode.redis.ConcurrentLoopingThreads; +import org.apache.geode.redis.session.springRedisTestApplication.config.DUnitSocketAddressResolver; +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 HlenDUnitTest { + + @ClassRule + public static RedisClusterStartupRule cluster = new RedisClusterStartupRule(); + + @ClassRule + public static ExecutorServiceRule executor = new ExecutorServiceRule(); + + private static final int HASH_SIZE = 5000; + private static final int NUM_ITERATIONS = 5; + private static MemberVM locator; + private static MemberVM server1; + private static MemberVM server2; + private static int[] redisPorts; + private static RedisCommands lettuce; + private static StatefulRedisConnection connection; + private static ClientResources resources; + + @BeforeClass + public static void classSetup() { +redisPorts = AvailablePortHelper.getRandomAvailableTCPPorts(3); + +String redisPort1 = String.valueOf(redisPorts[0]); +String redisPort2 = String.valueOf(redisPorts[1]); + +locator = cluster.startLocatorVM(0); + +server1 = startRedisVM(1, redisPorts[0]); +server2 = startRedisVM(2, redisPorts[1]); + +DUnitSocketAddressResolver dnsResolver = +new DUnitSocketAddressResolver(new String[] {redisPort2, redisPort1}); + +resources = ClientResources.builder().socketAddressResolver(dnsResolver).build(); + +RedisClient redisClient = RedisClient.create(resources, "redis://localhost"); + redisClient.setOptions(ClientOptions.builder().autoReconnect(true).build()); + +connection = redisClient.connect(); +lettuce = connection.sync(); + } + + private static MemberVM startRedisVM(int vmID, int redisPort) { +int locatorPort = locator.getPort(); + +return cluster.startRedisVM(vmID, (x) -> x +.withConnectionToLocator(locatorPort) +.withProperty(REDIS_PORT, "" + redisPort)); + } + + @Before + public void testSetup() { +lettuce.flushall(); + } + + @AfterClass + public static void tearDown() throws Exception { +resources.shutdown().get(); +connection.close(); + +server1.stop(); +server2.stop(); + } + + @Test + public void testConcurrentHLens_returnExpectedLength() { +AtomicLong client1Len = new AtomicLong(); +AtomicLong client2Len = new AtomicLong(); + +String key = "HLEN"; + +Map setUpData = makeInitialHashMap(HASH_SIZE, "field", "value"); + +lettuce.hset(key, setUpData); + +new ConcurrentLoopingThreads(NUM_ITERATIONS, +i -> { + long len = lettuce.hlen(key); + client1Len.addAndGet(len); +}, +i -> { + long len = lettuce.hlen(key); + client2Len.addAndGet(len); +}) +.run(); + +assertThat(client1Len
[jira] [Commented] (GEODE-8867) Unit/Integration/multi-node concurrency (Dunit) tests for **HLEN** command
[ https://issues.apache.org/jira/browse/GEODE-8867?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17273043#comment-17273043 ] ASF GitHub Bot commented on GEODE-8867: --- sabbey37 commented on a change in pull request #5955: URL: https://github.com/apache/geode/pull/5955#discussion_r565504360 ## File path: geode-redis/src/distributedTest/java/org/apache/geode/redis/internal/executor/hash/HlenDUnitTest.java ## @@ -0,0 +1,170 @@ +/* + * 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.executor.hash; + +import static org.apache.geode.distributed.ConfigurationProperties.REDIS_PORT; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; + +import io.lettuce.core.ClientOptions; +import io.lettuce.core.RedisClient; +import io.lettuce.core.api.StatefulRedisConnection; +import io.lettuce.core.api.sync.RedisCommands; +import io.lettuce.core.resource.ClientResources; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; + +import org.apache.geode.internal.AvailablePortHelper; +import org.apache.geode.redis.ConcurrentLoopingThreads; +import org.apache.geode.redis.session.springRedisTestApplication.config.DUnitSocketAddressResolver; +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 HlenDUnitTest { + + @ClassRule + public static RedisClusterStartupRule cluster = new RedisClusterStartupRule(); + + @ClassRule + public static ExecutorServiceRule executor = new ExecutorServiceRule(); + + private static final int HASH_SIZE = 5000; + private static final int NUM_ITERATIONS = 5; + private static MemberVM locator; + private static MemberVM server1; + private static MemberVM server2; + private static int[] redisPorts; + private static RedisCommands lettuce; + private static StatefulRedisConnection connection; + private static ClientResources resources; + + @BeforeClass + public static void classSetup() { +redisPorts = AvailablePortHelper.getRandomAvailableTCPPorts(3); + +String redisPort1 = String.valueOf(redisPorts[0]); +String redisPort2 = String.valueOf(redisPorts[1]); + +locator = cluster.startLocatorVM(0); + +server1 = startRedisVM(1, redisPorts[0]); +server2 = startRedisVM(2, redisPorts[1]); + +DUnitSocketAddressResolver dnsResolver = +new DUnitSocketAddressResolver(new String[] {redisPort2, redisPort1}); + +resources = ClientResources.builder().socketAddressResolver(dnsResolver).build(); + +RedisClient redisClient = RedisClient.create(resources, "redis://localhost"); + redisClient.setOptions(ClientOptions.builder().autoReconnect(true).build()); + +connection = redisClient.connect(); +lettuce = connection.sync(); + } + + private static MemberVM startRedisVM(int vmID, int redisPort) { +int locatorPort = locator.getPort(); + +return cluster.startRedisVM(vmID, (x) -> x +.withConnectionToLocator(locatorPort) +.withProperty(REDIS_PORT, "" + redisPort)); + } + + @Before + public void testSetup() { +lettuce.flushall(); + } + + @AfterClass + public static void tearDown() throws Exception { +resources.shutdown().get(); +connection.close(); + +server1.stop(); +server2.stop(); + } + + @Test + public void testConcurrentHLens_returnExpectedLength() { +AtomicLong client1Len = new AtomicLong(); +AtomicLong client2Len = new AtomicLong(); + +String key = "HLEN"; + +Map setUpData = makeInitialHashMap(HASH_SIZE, "field", "value"); + +lettuce.hset(key, setUpData); + +new ConcurrentLoopingThreads(NUM_ITERATIONS, +i -> { + long len = lettuce.hlen(key); + client1Len.addAndGet(len); +}, +i -> { + long len = lettuce.hlen(key); + client2Len.addAndGet(len); +}) +.run(); + +assertThat(client1Len
[jira] [Commented] (GEODE-8867) Unit/Integration/multi-node concurrency (Dunit) tests for **HLEN** command
[ https://issues.apache.org/jira/browse/GEODE-8867?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17273103#comment-17273103 ] ASF GitHub Bot commented on GEODE-8867: --- nonbinaryprogrammer commented on a change in pull request #5955: URL: https://github.com/apache/geode/pull/5955#discussion_r565567826 ## File path: geode-redis/src/distributedTest/java/org/apache/geode/redis/internal/executor/hash/HlenDUnitTest.java ## @@ -0,0 +1,170 @@ +/* + * 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.executor.hash; + +import static org.apache.geode.distributed.ConfigurationProperties.REDIS_PORT; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; + +import io.lettuce.core.ClientOptions; +import io.lettuce.core.RedisClient; +import io.lettuce.core.api.StatefulRedisConnection; +import io.lettuce.core.api.sync.RedisCommands; +import io.lettuce.core.resource.ClientResources; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; + +import org.apache.geode.internal.AvailablePortHelper; +import org.apache.geode.redis.ConcurrentLoopingThreads; +import org.apache.geode.redis.session.springRedisTestApplication.config.DUnitSocketAddressResolver; +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 HlenDUnitTest { + + @ClassRule + public static RedisClusterStartupRule cluster = new RedisClusterStartupRule(); + + @ClassRule + public static ExecutorServiceRule executor = new ExecutorServiceRule(); + + private static final int HASH_SIZE = 5000; + private static final int NUM_ITERATIONS = 5; + private static MemberVM locator; + private static MemberVM server1; + private static MemberVM server2; + private static int[] redisPorts; + private static RedisCommands lettuce; + private static StatefulRedisConnection connection; + private static ClientResources resources; + + @BeforeClass + public static void classSetup() { +redisPorts = AvailablePortHelper.getRandomAvailableTCPPorts(3); + +String redisPort1 = String.valueOf(redisPorts[0]); +String redisPort2 = String.valueOf(redisPorts[1]); + +locator = cluster.startLocatorVM(0); + +server1 = startRedisVM(1, redisPorts[0]); +server2 = startRedisVM(2, redisPorts[1]); + +DUnitSocketAddressResolver dnsResolver = +new DUnitSocketAddressResolver(new String[] {redisPort2, redisPort1}); + +resources = ClientResources.builder().socketAddressResolver(dnsResolver).build(); + +RedisClient redisClient = RedisClient.create(resources, "redis://localhost"); + redisClient.setOptions(ClientOptions.builder().autoReconnect(true).build()); + +connection = redisClient.connect(); +lettuce = connection.sync(); + } + + private static MemberVM startRedisVM(int vmID, int redisPort) { +int locatorPort = locator.getPort(); + +return cluster.startRedisVM(vmID, (x) -> x +.withConnectionToLocator(locatorPort) +.withProperty(REDIS_PORT, "" + redisPort)); + } + + @Before + public void testSetup() { +lettuce.flushall(); + } + + @AfterClass + public static void tearDown() throws Exception { +resources.shutdown().get(); +connection.close(); + +server1.stop(); +server2.stop(); + } + + @Test + public void testConcurrentHLens_returnExpectedLength() { +AtomicLong client1Len = new AtomicLong(); +AtomicLong client2Len = new AtomicLong(); + +String key = "HLEN"; + +Map setUpData = makeInitialHashMap(HASH_SIZE, "field", "value"); + +lettuce.hset(key, setUpData); + +new ConcurrentLoopingThreads(NUM_ITERATIONS, +i -> { + long len = lettuce.hlen(key); + client1Len.addAndGet(len); +}, +i -> { + long len = lettuce.hlen(key); + client2Len.addAndGet(len); +}) +.run(); + +assertThat
[jira] [Commented] (GEODE-8867) Unit/Integration/multi-node concurrency (Dunit) tests for **HLEN** command
[ https://issues.apache.org/jira/browse/GEODE-8867?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17273183#comment-17273183 ] ASF GitHub Bot commented on GEODE-8867: --- nonbinaryprogrammer merged pull request #5955: URL: https://github.com/apache/geode/pull/5955 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 > Unit/Integration/multi-node concurrency (Dunit) tests for **HLEN** command > -- > > Key: GEODE-8867 > URL: https://issues.apache.org/jira/browse/GEODE-8867 > Project: Geode > Issue Type: Test > Components: redis >Reporter: Helena Bales >Assignee: Helena Bales >Priority: Major > Labels: pull-request-available > > Write unit and integration tests. > Write dunit tests, to launch multi-node clusters, which test multiple > concurrent clients accessing different servers for the following command: > HLEN > A.C. > Tests are passing, and README/redis_api_for_geode.html.md.erb updated to > make command "supported", or > Stories in the backlog to fix the identified issues (with JIRA tickets) > and problem tests ignored -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (GEODE-8867) Unit/Integration/multi-node concurrency (Dunit) tests for **HLEN** command
[ https://issues.apache.org/jira/browse/GEODE-8867?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17273185#comment-17273185 ] ASF subversion and git services commented on GEODE-8867: Commit dafd28899f30fc73de65412b04aadce8b8328c36 in geode's branch refs/heads/develop from Hale Bales [ https://gitbox.apache.org/repos/asf?p=geode.git;h=dafd288 ] GEODE-8867: Add tests for HLEN (#5955) - add unit/integration tests - fix up a couple of other unit/integration tests - add Dunit tests for hlen concurrency - update docs for HLEN - update supportedCommandsJUnitTest for HLEN - update docs and supportedCommandsJUnitTest for a few other commands we forgot about before - add test for hlen while deleting Signed-off-by: Ray Ingles > Unit/Integration/multi-node concurrency (Dunit) tests for **HLEN** command > -- > > Key: GEODE-8867 > URL: https://issues.apache.org/jira/browse/GEODE-8867 > Project: Geode > Issue Type: Test > Components: redis >Reporter: Helena Bales >Assignee: Helena Bales >Priority: Major > Labels: pull-request-available > > Write unit and integration tests. > Write dunit tests, to launch multi-node clusters, which test multiple > concurrent clients accessing different servers for the following command: > HLEN > A.C. > Tests are passing, and README/redis_api_for_geode.html.md.erb updated to > make command "supported", or > Stories in the backlog to fix the identified issues (with JIRA tickets) > and problem tests ignored -- This message was sent by Atlassian Jira (v8.3.4#803005)