You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dg...@apache.org on 2019/05/31 10:08:31 UTC

[ignite] branch master updated: IGNITE-11861 Muted GridEventConsumeSelfTest.testMultithreadedWithNodeRestart fails on TC

This is an automated email from the ASF dual-hosted git repository.

dgovorukhin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 716ebb2  IGNITE-11861 Muted GridEventConsumeSelfTest.testMultithreadedWithNodeRestart fails on TC
716ebb2 is described below

commit 716ebb2fafbbb7b5571219187ac6f75a10789b85
Author: Ivan Bessonov <be...@gmail.com>
AuthorDate: Fri May 31 13:08:07 2019 +0300

    IGNITE-11861 Muted GridEventConsumeSelfTest.testMultithreadedWithNodeRestart fails on TC
    
    Signed-off-by: Dmitriy Govorukhin <dm...@gmail.com>
---
 .../continuous/GridEventConsumeSelfTest.java       | 41 ++++++++++++----------
 .../apache/ignite/testframework/GridTestUtils.java | 25 +++++++++++++
 2 files changed, 47 insertions(+), 19 deletions(-)

diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
index 8429683..756d3ba 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
@@ -49,6 +49,7 @@ import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.resources.IgniteInstanceResource;
 import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -95,6 +96,8 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
+        cfg.setConsistentId(igniteInstanceName);
+
         ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
 
         if (include)
@@ -878,7 +881,7 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
 
             include = true;
 
-            startGrid("anotherGrid");
+            startGrid("anotherGridNodeJoin");
 
             grid(0).compute().broadcast(F.noop());
 
@@ -888,7 +891,7 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
             assertEquals(GRID_CNT + 1, cnt.get());
         }
         finally {
-            stopGrid("anotherGrid");
+            stopGrid("anotherGridNodeJoin");
 
             grid(0).events().stopRemoteListen(consumeId);
         }
@@ -926,11 +929,11 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
 
             include = true;
 
-            startGrid("anotherGrid1");
+            startGrid("anotherGridNodeJoinWithProjection1");
 
             include = false;
 
-            startGrid("anotherGrid2");
+            startGrid("anotherGridNodeJoinWithProjection2");
 
             grid(0).compute().broadcast(F.noop());
 
@@ -940,8 +943,8 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
             assertEquals(GRID_CNT, cnt.get());
         }
         finally {
-            stopGrid("anotherGrid1");
-            stopGrid("anotherGrid2");
+            stopGrid("anotherGridNodeJoinWithProjection1");
+            stopGrid("anotherGridNodeJoinWithProjection2");
 
             grid(0).events().stopRemoteListen(consumeId);
         }
@@ -981,7 +984,7 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
         try {
             assertNotNull(consumeId);
 
-            startGrid("anotherGrid");
+            startGrid("anotherGridNodeJoinWithP2P");
 
             grid(0).compute().broadcast(F.noop());
 
@@ -991,7 +994,7 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
             assertEquals(GRID_CNT + 1, cnt.get());
         }
         finally {
-            stopGrid("anotherGrid");
+            stopGrid("anotherGridNodeJoinWithP2P");
 
             grid(0).events().stopRemoteListen(consumeId);
         }
@@ -1059,7 +1062,7 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
     public void testMasterNodeLeave() throws Exception {
         final CountDownLatch latch = new CountDownLatch(GRID_CNT);
 
-        Ignite g = startGrid("anotherGrid");
+        Ignite g = startGrid("anotherGridMasterNodeLeave");
 
         try {
             final UUID nodeId = g.cluster().localNode().id();
@@ -1086,7 +1089,7 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
 
         }
         finally {
-            stopGrid("anotherGrid");
+            stopGrid("anotherGridMasterNodeLeave");
         }
 
         assert latch.await(3000, MILLISECONDS);
@@ -1097,7 +1100,7 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
      */
     @Test
     public void testMasterNodeLeaveNoAutoUnsubscribe() throws Exception {
-        Ignite g = startGrid("anotherGrid");
+        Ignite g = startGrid("anotherGridMasterNodeLeaveNoAutoUnsubscribe");
 
         final CountDownLatch discoLatch;
 
@@ -1138,7 +1141,7 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
             grid(0).compute().broadcast(F.noop());
         }
         finally {
-            stopGrid("anotherGrid");
+            stopGrid("anotherGridMasterNodeLeaveNoAutoUnsubscribe");
         }
 
         discoLatch.await(3000, MILLISECONDS);
@@ -1154,6 +1157,7 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     @Test
+    @Ignore("https://issues.apache.org/jira/browse/IGNITE-11861")
     public void testMultithreadedWithNodeRestart() throws Exception {
         final AtomicBoolean stop = new AtomicBoolean();
         final BlockingQueue<IgniteBiTuple<Integer, UUID>> queue = new LinkedBlockingQueue<>();
@@ -1166,7 +1170,7 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
 
         IgniteInternalFuture<?> starterFut = multithreadedAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {
-                for (int i = 0; i < consumeCnt; i++) {
+                for (int i = 0; i < consumeCnt && !stop.get(); i++) {
                     int idx = rnd.nextInt(GRID_CNT);
 
                     try {
@@ -1195,6 +1199,8 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
             }
         }, 8, "consume-starter");
 
+        starterFut.listen(fut -> stop.set(true));
+
         IgniteInternalFuture<?> stopperFut = multithreadedAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {
                 while (!stop.get()) {
@@ -1225,8 +1231,8 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
         IgniteInternalFuture<?> nodeRestarterFut = multithreadedAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {
                 while (!stop.get()) {
-                    startGrid("anotherGrid");
-                    stopGrid("anotherGrid");
+                    startGrid("anotherGridMultithreadedWithNodeRestart");
+                    stopGrid("anotherGridMultithreadedWithNodeRestart");
                 }
 
                 return null;
@@ -1250,10 +1256,7 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
             }
         }, 1, "job-runner");
 
-        starterFut.get();
-        stopperFut.get();
-        nodeRestarterFut.get();
-        jobRunnerFut.get();
+        GridTestUtils.waitForAllFutures(starterFut, stopperFut, nodeRestarterFut, jobRunnerFut);
 
         IgniteBiTuple<Integer, UUID> t;
 
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
index fb8f49f..629f457 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
@@ -1028,6 +1028,31 @@ public final class GridTestUtils {
     }
 
     /**
+     * Wait for all passed futures to complete even if they fail.
+     *
+     * @param futs Futures.
+     * @throws AssertionError Suppresses underlying exceptions if some futures failed.
+     */
+    public static void waitForAllFutures(IgniteInternalFuture<?>... futs) {
+        AssertionError err = null;
+
+        for (IgniteInternalFuture<?> fut : futs) {
+            try {
+                fut.get();
+            }
+            catch (Throwable t) {
+                if (err == null)
+                    err = new AssertionError("One or several futures threw the exception.");
+
+                err.addSuppressed(t);
+            }
+        }
+
+        if (err != null)
+            throw err;
+    }
+
+    /**
      * Interrupts and waits for termination of all the threads started
      * so far by current test.
      *