chesnokoff commented on code in PR #12301:
URL: https://github.com/apache/ignite/pull/12301#discussion_r2466190123


##########
modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java:
##########
@@ -51,67 +84,406 @@ public class GridReleaseTypeSelfTest extends 
GridCommonAbstractTest {
 
         cfg.setDiscoverySpi(discoSpi);
 
+        DataStorageConfiguration storageCfg = new DataStorageConfiguration();
+
+        
storageCfg.getDefaultDataRegionConfiguration().setPersistenceEnabled(persistence);
+
+        cfg.setDataStorageConfiguration(storageCfg);
+
         return cfg;
     }
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
         stopAllGrids();
+        cleanPersistenceDir();
     }
 
-    /**
-     * @throws Exception If failed.
-     */
+    /** */
+    @Test
+    public void testTwoConflictVersions() {
+        testConflictVersions("2.18.0", "2.16.0", isClient);
+        testConflictVersions("2.21.0", "2.23.1", isClient);
+        testConflictVersions("2.20.1", "2.20.2", isClient);
+    }
+
+    /** */
+    @Test
+    public void testThreeConflictVersions() throws Exception {
+        testConflictVersionsWithRollingUpgrade("2.18.0", "2.18.1", "2.18.2", 
isClient, "2.18.1");
+
+        testConflictVersionsWithRollingUpgrade("2.18.0", "2.18.1", "2.17.2", 
isClient, "2.18.1");
+
+        testConflictVersionsWithRollingUpgrade("2.18.1", "2.19.0", "2.19.1", 
isClient, "2.19.0");
+
+        testConflictVersionsWithRollingUpgrade("2.18.1", "2.18.2", "2.18.0", 
isClient, "2.18.2");
+    }
+
+    /** */
+    @Test
+    public void testTwoCompatibleVersions() throws Exception {
+        testCompatibleVersions("2.18.0", "2.18.0", isClient, null);
+        testCompatibleVersions("2.19.2", "2.19.2", isClient, null);
+
+        testCompatibleVersions("2.18.0", "2.18.1", isClient, "2.18.1");
+        testCompatibleVersions("2.18.2", "2.19.0", isClient, "2.19.0");
+    }
+
+    /** */
+    @Test
+    public void testThreeCompatibleVersions() throws Exception {
+        testCompatibleVersions("2.18.0", "2.18.0", "2.18.0", isClient, null);
+        testCompatibleVersions("2.18.2", "2.18.2", "2.18.2", isClient, null);
+
+        testCompatibleVersions("2.18.0", "2.18.1", "2.18.1", isClient, 
"2.18.1");
+        testCompatibleVersions("2.18.1", "2.19.0", "2.18.1", isClient, 
"2.19.0");
+    }
+
+    /** */
     @Test
-    public void testOsEditionDoesNotSupportRollingUpdates() throws Exception {
-        nodeVer = "1.0.0";
+    public void testForwardRollingUpgrade() throws Exception {
+        cleanPersistenceDir();
+        IgniteEx ign0 = startGrid(0, "2.18.0", false);
+        IgniteEx ign1 = startGrid(1, "2.18.0", isClient);
+        IgniteEx ign2 = startGrid(2, "2.18.0", isClient);
 
-        startGrid(0);
+        assertClusterSize(3);
 
-        try {
-            nodeVer = "1.0.1";
+        assertRemoteRejected(() -> startGrid(3, "2.18.1", isClient));
 
-            startGrid(1);
+        configureRollingUpgradeVersion(ign0, "2.18.1");
 
-            fail("Exception has not been thrown.");
+        for (int i = 0; i < 3; i++) {
+            int finalI = i;
+            assertTrue(waitForCondition(() -> 
grid(finalI).context().rollingUpgrade().enabled(), getTestTimeout()));
         }
-        catch (IgniteCheckedException e) {
-            StringWriter errors = new StringWriter();
 
-            e.printStackTrace(new PrintWriter(errors));
+        ign2.close();
+
+        assertClusterSize(2);
+
+        startGrid(2, "2.18.1", isClient);
+
+        assertClusterSize(3);
+
+        ign1.close();
+
+        assertClusterSize(2);
+
+        startGrid(1, "2.18.1", isClient);
+
+        assertClusterSize(3);
+
+        ign0.close();
 
-            String stackTrace = errors.toString();
+        assertClusterSize(2);
 
-            if (!stackTrace.contains("Local node and remote node have 
different version numbers"))
-                throw e;
+        startGrid(0, "2.18.1", false);
+
+        assertClusterSize(3);
+
+        if (isClient)
+            grid(0).context().rollingUpgrade().disable();
+        else
+            grid(2).context().rollingUpgrade().disable();
+
+        for (int i = 0; i < 3; i++) {
+            if (!grid(i).localNode().isClient())
+                assertFalse(grid(i).context().rollingUpgrade().enabled());

Review Comment:
   Fails if grid is client and waitForCondition does not help. Looks like 
metastorage gives us less guarantee about client grids



-- 
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