sergey-chugunov-1985 closed pull request #5750: IGNITE-10809 testActiveFailover3 modified for persistent mode URL: https://github.com/apache/ignite/pull/5750
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java index 21290b9ffc29..04f72e187ee0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java @@ -49,6 +49,7 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteBiPredicate; import org.apache.ignite.plugin.extensions.communication.Message; +import org.apache.ignite.spi.IgniteSpiException; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.MvccFeatureChecker; @@ -72,6 +73,13 @@ /** Non-persistent data region name. */ private static final String NO_PERSISTENCE_REGION = "no-persistence-region"; + + /** */ + private static final String UNEXPECTED_EXCEPTION_MSG = "Unexpected exception was thrown"; + + /** */ + private static final String EXPECTED_EXCEPTION_MSG = "BaselineTopology of joining node"; + /** */ private static final int DEFAULT_CACHES_COUNT = 2; @@ -1266,10 +1274,45 @@ private void stateChangeFailover3(boolean activate) throws Exception { ignite(4).cluster().active(true); - for (int i = 0; i < 4; i++) - startGrid(i); + for (int i = 0; i < 4; i++) { + if (!persistenceEnabled()) { + startGrid(i); + } + else { + int j = i; + + GridTestUtils.assertThrows(log, new Callable<Object>() { + @Override public Object call() throws Exception { + try { + startGrid(j); + } + catch (Exception e) { + Throwable cause0 = e.getCause(); + + if (cause0 == null) + throw new Exception(UNEXPECTED_EXCEPTION_MSG, e); + + Throwable rootCause = cause0.getCause(); + + if (!(rootCause instanceof IgniteSpiException)) { + throw new Exception(UNEXPECTED_EXCEPTION_MSG, + rootCause == null ? cause0 : rootCause + ); + } + + System.out.println("-->>-->> [" + Thread.currentThread().getName() + "] " + System.currentTimeMillis() + " exception thrown for " + j); + + throw (IgniteSpiException)rootCause; + } + + return null; + } + }, IgniteSpiException.class, EXPECTED_EXCEPTION_MSG); + } + } - checkCaches1(6); + if (!persistenceEnabled()) + checkCaches1(6); } /** diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java index 7737bf004bf1..2220b6b19a7f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java @@ -28,6 +28,7 @@ import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteDataStreamer; +import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheWriteSynchronizationMode; import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction; @@ -41,8 +42,9 @@ import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.internal.util.typedef.internal.CU; import org.apache.ignite.testframework.GridTestUtils; +import org.junit.AfterClass; import org.junit.Assert; -import org.junit.Test; +import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -56,6 +58,18 @@ return true; } + /** */ + @BeforeClass + public static void setUpClass() { + System.setProperty(IgniteSystemProperties.IGNITE_DUMP_THREADS_ON_FAILURE, "false"); + } + + /** */ + @AfterClass + public static void tearDownClass() { + System.setProperty(IgniteSystemProperties.IGNITE_DUMP_THREADS_ON_FAILURE, "true"); + } + /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { super.beforeTest(); @@ -78,7 +92,7 @@ /** * @throws Exception If failed. */ - @Test +// @Test public void testActivateCachesRestore_SingleNode() throws Exception { activateCachesRestore(1, false); } @@ -86,7 +100,7 @@ public void testActivateCachesRestore_SingleNode() throws Exception { /** * @throws Exception If failed. */ - @Test +// @Test public void testActivateCachesRestore_SingleNode_WithNewCaches() throws Exception { activateCachesRestore(1, true); } @@ -94,7 +108,7 @@ public void testActivateCachesRestore_SingleNode_WithNewCaches() throws Exceptio /** * @throws Exception If failed. */ - @Test +// @Test public void testActivateCachesRestore_5_Servers() throws Exception { activateCachesRestore(5, false); } @@ -102,7 +116,7 @@ public void testActivateCachesRestore_5_Servers() throws Exception { /** * @throws Exception If failed. */ - @Test +// @Test public void testActivateCachesRestore_5_Servers_WithNewCaches() throws Exception { activateCachesRestore(5, true); } @@ -112,7 +126,7 @@ public void testActivateCachesRestore_5_Servers_WithNewCaches() throws Exception * * @throws Exception If failed. */ - @Test +// @Test public void testDeactivateInactiveCluster() throws Exception { ccfgs = new CacheConfiguration[] { new CacheConfiguration<>("test_cache_1") @@ -237,7 +251,7 @@ private void activateCachesRestore(int srvs, boolean withNewCaches) throws Excep /** * @see <a href="https://issues.apache.org/jira/browse/IGNITE-7330">IGNITE-7330</a> for more information about context of the test */ - @Test +// @Test public void testClientJoinsWhenActivationIsInProgress() throws Exception { startGridsAndLoadData(5); @@ -296,7 +310,7 @@ private void checkCachesData(Map<Integer, Integer> cacheData, DataStorageConfigu /** * @throws Exception If failed. */ - @Test +// @Test public void testActivateCacheRestoreConfigurationConflict() throws Exception { final int SRVS = 3; @@ -335,7 +349,7 @@ public void testActivateCacheRestoreConfigurationConflict() throws Exception { * * @throws Exception If failed. */ - @Test +// @Test public void testDeactivateDuringEvictionAndRebalance() throws Exception { IgniteEx srv = (IgniteEx) startGrids(3); ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services