anton-vinogradov commented on code in PR #13184:
URL: https://github.com/apache/ignite/pull/13184#discussion_r3477020647


##########
modules/compatibility/src/test/java/org/apache/ignite/compatibility/ru/IgniteRebalanceOnUpgradeTest.java:
##########
@@ -0,0 +1,232 @@
+/*
+ * 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.ru;
+
+import java.io.File;
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.client.ClientCache;
+import org.apache.ignite.client.ClientCacheConfiguration;
+import org.apache.ignite.client.IgniteClient;
+import 
org.apache.ignite.compatibility.testframework.testcontainers.IgniteClusterContainer;
+import 
org.apache.ignite.compatibility.testframework.testcontainers.IgniteContainer;
+import org.apache.ignite.configuration.ClientConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static 
org.apache.ignite.compatibility.testframework.testcontainers.IgniteContainer.LOCAL_WORK_DIR_PATH;
+import static org.apache.ignite.testframework.GridTestUtils.DFLT_TEST_TIMEOUT;
+import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
+
+/** Smoke test for rolling upgrade with persistence. */
+public class IgniteRebalanceOnUpgradeTest extends GridCommonAbstractTest {
+    /** Consistent ID's. */
+    private static final List<String> CONSISTENT_IDS = List.of(
+        "ad26bff6-5ff5-49f1-9a61-425a827953ed",
+        "c1099d16-e7d7-49f4-925c-53329286c444",
+        "7b880b69-8a9e-4b84-b555-250d365e2e67"
+    );
+
+    /** Source commit hash. Used for docker image tag. */
+    private static final String SOURCE_COMMIT_HASH = 
"0ad4656eef09acda288cbad96f80f0138732d94a";
+
+    /** Cache name. */
+    private static final String CACHE_NAME = "ru-test-cache";
+
+    /** Local work directory. */
+    private static final File LOCAL_WORK_DIR = new File(LOCAL_WORK_DIR_PATH);
+
+    /** Local nodes. */
+    private final List<IgniteEx> nodes = new ArrayList<>();
+
+    /** Consistent ID -> discovery address. */
+    private final Map<String, String> addrs = new HashMap<>();
+
+    /** Thin client. */
+    private IgniteClient client;
+
+    /** */
+    @BeforeClass
+    public static void beforeClass() {
+        U.delete(LOCAL_WORK_DIR);
+    }
+
+    /** */
+    @AfterClass
+    public static void afterClass() {
+        U.delete(LOCAL_WORK_DIR);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean isMultiJvm() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected long getTestTimeout() {
+        return super.getTestTimeout() * 2;
+    }
+
+    /** Basic RU test. */
+    @Test
+    public void testRollingUpgrade() throws Exception {
+        try (IgniteClusterContainer cluster = new 
IgniteClusterContainer(SOURCE_COMMIT_HASH, CONSISTENT_IDS)) {
+            cluster.start();
+
+            for (IgniteContainer container : cluster.containers())
+                addrs.put(container.consistentId(), 
container.discoveryAddress());
+
+            ClientCacheConfiguration cfg = new ClientCacheConfiguration()
+                .setName(CACHE_NAME)
+                .setBackups(1)
+                .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+
+            ClientCache<Integer, Integer> cache = 
client(cluster.containers().get(0).clientAddress()).createCache(cfg);
+
+            for (int i = 0; i < 1000; i++)
+                cache.put(i, i);
+
+            closeClient();
+            
+            upgradeCluster(cluster);
+
+            IgniteCache<Integer, Integer> targetCache = 
nodes.get(0).cache(CACHE_NAME);
+
+            for (int i = 0; i < 1000; i++)
+                assertEquals("Data mismatch after upgrade at key: " + i, i, 
(int)targetCache.get(i));
+
+            targetCache.put(1001, 1001);
+
+            assertEquals(1001, (int)targetCache.get(1001));
+        }
+        finally {
+            closeClient();
+        }
+    }
+
+    /** */
+    private void upgradeCluster(IgniteClusterContainer srcCluster) throws 
Exception {
+        for (IgniteContainer container : srcCluster.containers()) {
+            log.info(">>> Upgrade node=" + container.consistentId());
+
+            String hostIp = container.execInContainer("sh", "-c",
+                "getent ahostsv4 host.docker.internal | awk '{print $1}' | 
head -1").getStdout().trim();
+
+            container.stop();
+
+            addrs.remove(container.consistentId());
+
+            IgniteEx ignite = 
startGrid(configuration(container.consistentId(), 
container.localWorkDirectory(), addrs.values(), hostIp));
+
+            waitForCondition(() -> CONSISTENT_IDS.size() == 
ignite.cluster().nodes().size(), DFLT_TEST_TIMEOUT);

Review Comment:
   `waitForCondition(...)` return value is ignored. If the upgraded node never 
rejoins a 3-node topology within the timeout, the test silently continues and 
fails later with a misleading assertion. Assert the result so a failure points 
here.
   
   ```suggestion
               assertTrue("Upgraded node did not rejoin the full topology in 
time",
                   waitForCondition(() -> CONSISTENT_IDS.size() == 
ignite.cluster().nodes().size(), DFLT_TEST_TIMEOUT));
   ```



##########
modules/compatibility/src/test/java/org/apache/ignite/compatibility/ru/IgniteRebalanceOnUpgradeTest.java:
##########
@@ -0,0 +1,232 @@
+/*
+ * 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.ru;
+
+import java.io.File;
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.client.ClientCache;
+import org.apache.ignite.client.ClientCacheConfiguration;
+import org.apache.ignite.client.IgniteClient;
+import 
org.apache.ignite.compatibility.testframework.testcontainers.IgniteClusterContainer;
+import 
org.apache.ignite.compatibility.testframework.testcontainers.IgniteContainer;
+import org.apache.ignite.configuration.ClientConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static 
org.apache.ignite.compatibility.testframework.testcontainers.IgniteContainer.LOCAL_WORK_DIR_PATH;
+import static org.apache.ignite.testframework.GridTestUtils.DFLT_TEST_TIMEOUT;
+import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
+
+/** Smoke test for rolling upgrade with persistence. */
+public class IgniteRebalanceOnUpgradeTest extends GridCommonAbstractTest {
+    /** Consistent ID's. */
+    private static final List<String> CONSISTENT_IDS = List.of(
+        "ad26bff6-5ff5-49f1-9a61-425a827953ed",
+        "c1099d16-e7d7-49f4-925c-53329286c444",
+        "7b880b69-8a9e-4b84-b555-250d365e2e67"
+    );
+
+    /** Source commit hash. Used for docker image tag. */
+    private static final String SOURCE_COMMIT_HASH = 
"0ad4656eef09acda288cbad96f80f0138732d94a";

Review Comment:
   **The test is not reproducible after merge.** `SOURCE_COMMIT_HASH` points to 
`0ad4656`, an ephemeral `WIP` commit on this PR branch (3 commits behind HEAD) 
that is **not reachable from `master`**. After a squash-merge that SHA 
disappears, so nobody can build `apacheignite/ignite:0ad4656…` and the DEVNOTES 
workflow can't be followed.
   
   It also makes the “upgrade” run from the *same branch, 3 WIP commits back* — 
effectively self→self — so no real cross-version gap is exercised, which is the 
whole point of a rolling-upgrade test.
   
   Recommend basing the source side on a **released** version (a published 
`apacheignite/ignite:<GA>` image, or a release tag) and making it overridable 
via a system property instead of a hardcoded constant. The same hash currently 
has to be hand-synced across DEVNOTES Step 1/2 and this field — another reason 
to externalize 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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to