timoninmaxim commented on a change in pull request #8206: URL: https://github.com/apache/ignite/pull/8206#discussion_r494251704
########## File path: modules/core/src/test/java/org/apache/ignite/internal/client/thin/ThinClientPartitionAwarenessDiscoveryTest.java ########## @@ -0,0 +1,141 @@ +/* + * 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.ignite.internal.client.thin; + +import java.util.Arrays; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import org.apache.ignite.client.ClientAddressFinder; +import org.apache.ignite.client.ClientCache; +import org.apache.ignite.configuration.ClientConfiguration; +import org.apache.ignite.internal.IgnitionEx; +import org.apache.ignite.internal.processors.cache.IgniteInternalCache; +import org.junit.Test; + +import static org.apache.ignite.internal.processors.odbc.ClientListenerProcessor.CLIENT_LISTENER_PORT; + +/** + * Test partition awareness of thin client on changed topology. + */ +public class ThinClientPartitionAwarenessDiscoveryTest extends ThinClientAbstractPartitionAwarenessTest { + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + super.afterTest(); + + stopAllGrids(); + } + + /** + * Test that client use channels to all running nodes while new nodes start + */ + @Test + public void testClientDiscoveryNodesJoin() throws Exception { + for (int i = 0; i < MAX_CLUSTER_SIZE; ++i) { + startGrid(i); + awaitPartitionMapExchange(); + + int[] workChannels = IntStream.rangeClosed(0, i).toArray(); + + if (i == 0) + initClient(getClientConfigurationWithDiscovery(), workChannels); + else { + detectTopologyChange(); + awaitChannelsInit(workChannels); + } + + testPartitionAwareness(workChannels); + } + } + + /** + * Test that client use channels to all running nodes while nodes stop + */ + @Test + public void testClientDiscoveryNodesLeave() throws Exception { Review comment: Yes, it's ok that test will pass with default configuration too. It's like regression test, that discovery work expectedly. The case you describe will work the same way, it will pass both for default and discovery configurations, as both of them will configure the same set of channels. But it is a good test case and I've added it too. ---------------------------------------------------------------- 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: [email protected]
