jhutchison commented on a change in pull request #6493: URL: https://github.com/apache/geode/pull/6493#discussion_r636466758
########## File path: geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/pubsub/AbstractSubCommandsIntegrationTest.java ########## @@ -0,0 +1,156 @@ + +/* + * 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.pubsub; + +import static org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertAtLeastNArgs; +import static org.apache.geode.redis.internal.executor.pubsub.SubCommandExecutor.UNKNOWN_SUBCOMMAND_ERROR_BASE; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import java.util.ArrayList; +import java.util.concurrent.Callable; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.Protocol; + +import org.apache.geode.redis.RedisIntegrationTest; +import org.apache.geode.redis.mocks.MockSubscriber; +import org.apache.geode.test.awaitility.GeodeAwaitility; + +public abstract class AbstractSubCommandsIntegrationTest implements RedisIntegrationTest { + private Jedis subscriber; + private Jedis introspector; + private MockSubscriber mockSubscriber; + + @Before + public void setup() { + mockSubscriber = new MockSubscriber(); + subscriber = new Jedis("localhost", getPort()); + introspector = new Jedis("localhost", getPort()); + } + + @After + public void teardown() { + if (mockSubscriber.getSubscribedChannels() > 0) { + mockSubscriber.unsubscribe(); + } + waitFor(() -> mockSubscriber.getSubscribedChannels() == 0); Review comment: There's only one test right now that psubscribes, and it punsubscribes within that test. My thought was to give every test one subscriber and to unsubscribe from it- if a test needs something special, it needs to take care of that itself... If you're strongly opposed, let me know and I'll change. as far as the thread go, I saw that there is a lot of waiting on the threads to die in the subscribe test- Nothing seems to need it in the subComands test right now as far as I can tell. I would argue for waiting to add it until we need it? -- 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