wernerdv commented on code in PR #12301:
URL: https://github.com/apache/ignite/pull/12301#discussion_r2341424253
##########
modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java:
##########
@@ -59,59 +69,338 @@ public class GridReleaseTypeSelfTest extends
GridCommonAbstractTest {
stopAllGrids();
}
- /**
- * @throws Exception If failed.
- */
+ /** */
@Test
- public void testOsEditionDoesNotSupportRollingUpdates() throws Exception {
- nodeVer = "1.0.0";
+ public void testTwoConflictVersions() {
+ testConflictVersions("2.18.0", "2.16.0", false);
+ testConflictVersions("2.19.0", "2.17.6", false);
+ testConflictVersions("2.20.0", "2.22.2", false);
+ testConflictVersions("2.21.0", "2.23.1", false);
+ }
- startGrid(0);
+ /** */
+ @Test
+ public void testThreeConflictVersions() {
+ testConflictVersions("2.18.0", "2.18.2", "2.16.0", false);
+ testConflictVersions("2.18.0", "2.18.3", "2.20.0", false);
- try {
- nodeVer = "1.0.1";
+ testConflictVersions("2.18.0", "2.19.2", "2.17.0", false);
+ testConflictVersions("2.18.0", "2.17.3", "2.19.0", false);
- startGrid(1);
+ testConflictVersions("2.18.0", "2.19.2", "2.20.0", false);
+ testConflictVersions("2.18.0", "2.17.3", "2.16.0", false);
+ }
+
+ /** */
+ @Test
+ public void testTwoConflictVersionsWithClient() {
+ testConflictVersions("2.18.0", "2.16.0", true);
+ testConflictVersions("2.19.0", "2.17.6", true);
+ testConflictVersions("2.20.0", "2.22.2", true);
+ testConflictVersions("2.21.0", "2.23.1", true);
+ }
- fail("Exception has not been thrown.");
- }
- catch (IgniteCheckedException e) {
- StringWriter errors = new StringWriter();
+ /** */
+ @Test
+ public void testThreeConflictVersionsWithClients() {
+ testConflictVersions("2.18.0", "2.18.2", "2.16.0", true);
+ testConflictVersions("2.18.0", "2.18.3", "2.20.0", true);
- e.printStackTrace(new PrintWriter(errors));
+ testConflictVersions("2.18.0", "2.19.2", "2.17.0", true);
+ testConflictVersions("2.18.0", "2.17.3", "2.19.0", true);
- String stackTrace = errors.toString();
+ testConflictVersions("2.18.0", "2.19.2", "2.20.0", true);
+ testConflictVersions("2.18.0", "2.17.3", "2.16.0", true);
+ }
- if (!stackTrace.contains("Local node and remote node have
different version numbers"))
- throw e;
- }
+ /** */
+ @Test
+ public void testTwoCompatibleVersions() throws Exception {
+ testCompatibleVersions("2.18.0", "2.17.0", false);
+ testCompatibleVersions("2.19.0", "2.20.6", false);
+ testCompatibleVersions("2.20.0", "2.20.2", false);
+ testCompatibleVersions("2.21.0", "2.21.1", false);
}
- /**
- * @throws Exception If failed.
- */
+ /** */
@Test
- public void testOsEditionDoesNotSupportRollingUpdatesClientMode() throws
Exception {
- nodeVer = "1.0.0";
+ public void testThreeCompatibleVersions() throws Exception {
+ testCompatibleVersions("2.18.0", "2.18.2", "2.17.0", false);
+ testCompatibleVersions("2.18.0", "2.18.3", "2.19.0", false);
+
+ testCompatibleVersions("2.18.0", "2.19.2", "2.18.1", false);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.18.2", false);
+
+ testCompatibleVersions("2.18.0", "2.19.2", "2.19.6", false);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.17.1", false);
+
+ testCompatibleVersions("2.18.1", "2.18.2", "2.18.3", false);
+ }
+
+ /** */
+ @Test
+ public void testTwoCompatibleVersionsWithClient() throws Exception {
+ testCompatibleVersions("2.18.0", "2.17.0", true);
+ testCompatibleVersions("2.19.0", "2.20.6", true);
+ testCompatibleVersions("2.20.0", "2.20.2", true);
+ testCompatibleVersions("2.21.0", "2.21.1", true);
+ }
+
+ /** */
+ @Test
+ public void testThreeCompatibleVersionsWithClients() throws Exception {
+ testCompatibleVersions("2.18.0", "2.18.2", "2.17.0", true);
+ testCompatibleVersions("2.18.0", "2.18.3", "2.19.0", true);
+
+ testCompatibleVersions("2.18.0", "2.19.2", "2.18.1", true);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.18.2", true);
+
+ testCompatibleVersions("2.18.0", "2.19.2", "2.19.6", true);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.17.1", true);
+
+ testCompatibleVersions("2.18.1", "2.18.2", "2.18.3", true);
+ }
+
+ /** */
+ @Test
+ public void testForwardRollingUpgrade() throws Exception {
+ IgniteEx ign0 = startGrid(0, "2.18.0", false);
+ IgniteEx ign1 = startGrid(1, "2.18.0", false);
+ IgniteEx ign2 = startGrid(2, "2.18.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign2.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(2, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign1.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(1, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign0.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(0, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+ }
+
+ /** */
+ @Test
+ public void testBackwardRollingUpgrade() throws Exception {
+ IgniteEx ign0 = startGrid(0, "2.18.0", false);
+ IgniteEx ign1 = startGrid(1, "2.18.0", false);
+ IgniteEx ign2 = startGrid(2, "2.18.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign0.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(0, "2.17.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign1.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(1, "2.17.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign2.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(2, "2.17.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+ }
+
+ /** */
+ @Test
+ public void testForwardBackwardRollingUpgrade() throws Exception {
+ startGrid(0, "2.18.0", false);
+ IgniteEx ign1 = startGrid(1, "2.18.0", false);
+ IgniteEx ign2 = startGrid(2, "2.18.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
- startGrid(0);
+ ign1.close();
+ ign2.close();
- try {
- nodeVer = "1.0.1";
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 1,
getTestTimeout()));
- startClientGrid(1);
+ ign1 = startGrid(1, "2.19.0", false);
+ ign2 = startGrid(2, "2.19.0", false);
- fail("Exception has not been thrown.");
- }
- catch (IgniteCheckedException e) {
- StringWriter errors = new StringWriter();
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
- e.printStackTrace(new PrintWriter(errors));
+ ign1.close();
+ ign2.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 1,
getTestTimeout()));
+
+ startGrid(1, "2.17.0", false);
+ startGrid(2, "2.17.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+ }
+
+ /** */
+ @Test
+ public void testCoordinatorChange() throws Exception {
+ IgniteEx ign0 = startGrid(0, "2.18.0", false);
+ startGrid(1, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ ign0.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 1,
getTestTimeout()));
+
+ assertRemoteRejected(() -> startGrid(0, "2.17.0", false));
+
+ startGrid(0, "2.20.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ assertRemoteRejected(() -> startGrid(2, "2.21.0", false));
+
+ assertTrue(Ignition.allGrids().size() == 2);
+ }
+
+ /** */
+ @Test
+ public void testDifferentServersAndClients() throws Exception {
+ IgniteEx server0 = startGrid(0, "2.18.0", false);
+ IgniteEx server1 = startGrid(1, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startClientGridWithConnectionTo(2, "2.19.0", server0);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ startClientGridWithConnectionTo(3, "2.19.0", server1);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 4,
getTestTimeout()));
+
+ assertRemoteRejected(() -> startClientGridWithConnectionTo(4,
"2.17.0", server0));
+ assertRemoteRejected(() -> startClientGridWithConnectionTo(4,
"2.20.0", server1));
+
+ assertRemoteRejected(() -> startGrid(4, "2.20.0", false));
+ assertRemoteRejected(() -> startGrid(4, "2.17.0", false));
+
+ assertTrue(Ignition.allGrids().size() == 4);
+ }
+
+ /** Tests that starting a node with rejected version fails with remote
rejection. */
+ private void testConflictVersions(String acceptedVer, String rejVer,
boolean withClient) {
Review Comment:
`withClients` -> `isClient`
##########
modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java:
##########
@@ -59,59 +69,338 @@ public class GridReleaseTypeSelfTest extends
GridCommonAbstractTest {
stopAllGrids();
}
- /**
- * @throws Exception If failed.
- */
+ /** */
@Test
- public void testOsEditionDoesNotSupportRollingUpdates() throws Exception {
- nodeVer = "1.0.0";
+ public void testTwoConflictVersions() {
+ testConflictVersions("2.18.0", "2.16.0", false);
+ testConflictVersions("2.19.0", "2.17.6", false);
+ testConflictVersions("2.20.0", "2.22.2", false);
+ testConflictVersions("2.21.0", "2.23.1", false);
+ }
- startGrid(0);
+ /** */
+ @Test
+ public void testThreeConflictVersions() {
+ testConflictVersions("2.18.0", "2.18.2", "2.16.0", false);
+ testConflictVersions("2.18.0", "2.18.3", "2.20.0", false);
- try {
- nodeVer = "1.0.1";
+ testConflictVersions("2.18.0", "2.19.2", "2.17.0", false);
+ testConflictVersions("2.18.0", "2.17.3", "2.19.0", false);
- startGrid(1);
+ testConflictVersions("2.18.0", "2.19.2", "2.20.0", false);
+ testConflictVersions("2.18.0", "2.17.3", "2.16.0", false);
+ }
+
+ /** */
+ @Test
+ public void testTwoConflictVersionsWithClient() {
+ testConflictVersions("2.18.0", "2.16.0", true);
+ testConflictVersions("2.19.0", "2.17.6", true);
+ testConflictVersions("2.20.0", "2.22.2", true);
+ testConflictVersions("2.21.0", "2.23.1", true);
+ }
- fail("Exception has not been thrown.");
- }
- catch (IgniteCheckedException e) {
- StringWriter errors = new StringWriter();
+ /** */
+ @Test
+ public void testThreeConflictVersionsWithClients() {
+ testConflictVersions("2.18.0", "2.18.2", "2.16.0", true);
+ testConflictVersions("2.18.0", "2.18.3", "2.20.0", true);
- e.printStackTrace(new PrintWriter(errors));
+ testConflictVersions("2.18.0", "2.19.2", "2.17.0", true);
+ testConflictVersions("2.18.0", "2.17.3", "2.19.0", true);
- String stackTrace = errors.toString();
+ testConflictVersions("2.18.0", "2.19.2", "2.20.0", true);
+ testConflictVersions("2.18.0", "2.17.3", "2.16.0", true);
+ }
- if (!stackTrace.contains("Local node and remote node have
different version numbers"))
- throw e;
- }
+ /** */
+ @Test
+ public void testTwoCompatibleVersions() throws Exception {
+ testCompatibleVersions("2.18.0", "2.17.0", false);
+ testCompatibleVersions("2.19.0", "2.20.6", false);
+ testCompatibleVersions("2.20.0", "2.20.2", false);
+ testCompatibleVersions("2.21.0", "2.21.1", false);
}
- /**
- * @throws Exception If failed.
- */
+ /** */
@Test
- public void testOsEditionDoesNotSupportRollingUpdatesClientMode() throws
Exception {
- nodeVer = "1.0.0";
+ public void testThreeCompatibleVersions() throws Exception {
+ testCompatibleVersions("2.18.0", "2.18.2", "2.17.0", false);
+ testCompatibleVersions("2.18.0", "2.18.3", "2.19.0", false);
+
+ testCompatibleVersions("2.18.0", "2.19.2", "2.18.1", false);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.18.2", false);
+
+ testCompatibleVersions("2.18.0", "2.19.2", "2.19.6", false);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.17.1", false);
+
+ testCompatibleVersions("2.18.1", "2.18.2", "2.18.3", false);
+ }
+
+ /** */
+ @Test
+ public void testTwoCompatibleVersionsWithClient() throws Exception {
+ testCompatibleVersions("2.18.0", "2.17.0", true);
+ testCompatibleVersions("2.19.0", "2.20.6", true);
+ testCompatibleVersions("2.20.0", "2.20.2", true);
+ testCompatibleVersions("2.21.0", "2.21.1", true);
+ }
+
+ /** */
+ @Test
+ public void testThreeCompatibleVersionsWithClients() throws Exception {
+ testCompatibleVersions("2.18.0", "2.18.2", "2.17.0", true);
+ testCompatibleVersions("2.18.0", "2.18.3", "2.19.0", true);
+
+ testCompatibleVersions("2.18.0", "2.19.2", "2.18.1", true);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.18.2", true);
+
+ testCompatibleVersions("2.18.0", "2.19.2", "2.19.6", true);
+ testCompatibleVersions("2.18.0", "2.17.3", "2.17.1", true);
+
+ testCompatibleVersions("2.18.1", "2.18.2", "2.18.3", true);
+ }
+
+ /** */
+ @Test
+ public void testForwardRollingUpgrade() throws Exception {
+ IgniteEx ign0 = startGrid(0, "2.18.0", false);
+ IgniteEx ign1 = startGrid(1, "2.18.0", false);
+ IgniteEx ign2 = startGrid(2, "2.18.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign2.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(2, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign1.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(1, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign0.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(0, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+ }
+
+ /** */
+ @Test
+ public void testBackwardRollingUpgrade() throws Exception {
+ IgniteEx ign0 = startGrid(0, "2.18.0", false);
+ IgniteEx ign1 = startGrid(1, "2.18.0", false);
+ IgniteEx ign2 = startGrid(2, "2.18.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign0.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(0, "2.17.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign1.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(1, "2.17.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ ign2.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startGrid(2, "2.17.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+ }
+
+ /** */
+ @Test
+ public void testForwardBackwardRollingUpgrade() throws Exception {
+ startGrid(0, "2.18.0", false);
+ IgniteEx ign1 = startGrid(1, "2.18.0", false);
+ IgniteEx ign2 = startGrid(2, "2.18.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
- startGrid(0);
+ ign1.close();
+ ign2.close();
- try {
- nodeVer = "1.0.1";
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 1,
getTestTimeout()));
- startClientGrid(1);
+ ign1 = startGrid(1, "2.19.0", false);
+ ign2 = startGrid(2, "2.19.0", false);
- fail("Exception has not been thrown.");
- }
- catch (IgniteCheckedException e) {
- StringWriter errors = new StringWriter();
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
- e.printStackTrace(new PrintWriter(errors));
+ ign1.close();
+ ign2.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 1,
getTestTimeout()));
+
+ startGrid(1, "2.17.0", false);
+ startGrid(2, "2.17.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+ }
+
+ /** */
+ @Test
+ public void testCoordinatorChange() throws Exception {
+ IgniteEx ign0 = startGrid(0, "2.18.0", false);
+ startGrid(1, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ ign0.close();
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 1,
getTestTimeout()));
+
+ assertRemoteRejected(() -> startGrid(0, "2.17.0", false));
+
+ startGrid(0, "2.20.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ assertRemoteRejected(() -> startGrid(2, "2.21.0", false));
+
+ assertTrue(Ignition.allGrids().size() == 2);
+ }
+
+ /** */
+ @Test
+ public void testDifferentServersAndClients() throws Exception {
+ IgniteEx server0 = startGrid(0, "2.18.0", false);
+ IgniteEx server1 = startGrid(1, "2.19.0", false);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 2,
getTestTimeout()));
+
+ startClientGridWithConnectionTo(2, "2.19.0", server0);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 3,
getTestTimeout()));
+
+ startClientGridWithConnectionTo(3, "2.19.0", server1);
+
+ assertTrue(waitForCondition(() -> Ignition.allGrids().size() == 4,
getTestTimeout()));
+
+ assertRemoteRejected(() -> startClientGridWithConnectionTo(4,
"2.17.0", server0));
+ assertRemoteRejected(() -> startClientGridWithConnectionTo(4,
"2.20.0", server1));
+
+ assertRemoteRejected(() -> startGrid(4, "2.20.0", false));
+ assertRemoteRejected(() -> startGrid(4, "2.17.0", false));
+
+ assertTrue(Ignition.allGrids().size() == 4);
+ }
+
+ /** Tests that starting a node with rejected version fails with remote
rejection. */
+ private void testConflictVersions(String acceptedVer, String rejVer,
boolean withClient) {
Review Comment:
`withClient` -> `isClient`
--
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]