chesnokoff commented on code in PR #12671: URL: https://github.com/apache/ignite/pull/12671#discussion_r2758532303
########## modules/compatibility/src/test/java/org/apache/ignite/compatibility/spi/discovery/TcpDiscoveryDifferentClusterVersionsTest.java: ########## @@ -0,0 +1,81 @@ +/* + * 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.compatibility.spi.discovery; + +import org.apache.ignite.compatibility.IgniteReleasedVersion; +import org.apache.ignite.compatibility.testframework.junits.IgniteCompatibilityAbstractTest; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.testframework.GridTestUtils; +import org.apache.ignite.testframework.ListeningTestLogger; +import org.apache.ignite.testframework.LogListener; +import org.junit.Test; + +/** */ +public class TcpDiscoveryDifferentClusterVersionsTest extends IgniteCompatibilityAbstractTest { + /** */ + private static final String LEGACY_PROTOCOL_MSG = "Remote node uses legacy discovery protocol"; + + /** */ + private static final IgniteReleasedVersion OLD_VERSION = IgniteReleasedVersion.VER_2_17_0; + + /** */ + private ListeningTestLogger listeningLog; + + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + super.afterTest(); + + stopAllGrids(); + } + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); + + if (listeningLog != null) + cfg.setGridLogger(listeningLog); + + return cfg; + } + + /** + * Compatibility test that ensures previous-version client fails to connect to current server + * and server reports different IGNITE_HEADER. + */ + @Test + public void testOldClientRejected() throws Exception { + setLoggerDebugLevel(); + + listeningLog = new ListeningTestLogger(log); + + LogListener logListener = LogListener.matches(LEGACY_PROTOCOL_MSG).build(); + + listeningLog.registerListener(logListener); + + startGrid(0); + + GridTestUtils.assertThrows( + log, + () -> startGrid("old-client", OLD_VERSION.toString(), cfg -> cfg.setClientMode(true)), Review Comment: 1) Initial problem was related to connection between client and server node 2) Probably it would be a good idea to check server node too, but there is race condition between two nodes to become an initiator. As a result, new node may try to connect to old one and we won't get anything from logs -- 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]
