ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: ignite-1758-1 debug
Date Mon, 02 Nov 2015 13:21:25 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1758-debug [created] 68fcd281b


ignite-1758-1 debug


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/68fcd281
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/68fcd281
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/68fcd281

Branch: refs/heads/ignite-1758-debug
Commit: 68fcd281b3e67c374361b58ffdf97ca4d99f7909
Parents: dbda67a
Author: sboikov <sboikov@gridgain.com>
Authored: Mon Nov 2 16:20:51 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Mon Nov 2 16:20:51 2015 +0300

----------------------------------------------------------------------
 .../tcp/TcpDiscoveryMultiThreadedTest.java      | 137 +++++++++++--------
 .../ignite/testsuites/IgniteSpiTestSuite.java   |  33 +----
 2 files changed, 82 insertions(+), 88 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/68fcd281/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
index 55474dc..76afd1b 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
@@ -161,7 +161,7 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest
{
     /**
      * @throws Exception If any error occurs.
      */
-    public void testMultiThreadedClientsRestart() throws Exception {
+    public void _testMultiThreadedClientsRestart() throws Exception {
         final AtomicBoolean done = new AtomicBoolean();
 
         try {
@@ -209,9 +209,24 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest
{
     /**
      * @throws Exception If any error occurs.
      */
-    public void testMultiThreadedClientsServersRestart() throws Throwable {
+    public void _testMultiThreadedClientsServersRestart() throws Throwable {
         fail("https://issues.apache.org/jira/browse/IGNITE-1123");
 
+        multiThreadedClientsServersRestart(true);
+    }
+
+    /**
+     * @throws Exception If any error occurs.
+     */
+    public void testMultiThreadedServersRestart() throws Throwable {
+        multiThreadedClientsServersRestart(false);
+    }
+
+    /**
+     * @param clients If {@code true} restarts client nodes.
+     * @throws Exception If any error occurs.
+     */
+    private void multiThreadedClientsServersRestart(boolean clients) throws Throwable {
         final AtomicBoolean done = new AtomicBoolean();
 
         try {
@@ -221,80 +236,84 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest
{
 
             startGridsMultiThreaded(GRID_CNT);
 
-            clientFlagGlobal = true;
-
-            startGridsMultiThreaded(GRID_CNT, CLIENT_GRID_CNT);
+            IgniteInternalFuture<?> clientFut = null;
 
             final AtomicReference<Throwable> error = new AtomicReference<>();
 
-            final BlockingQueue<Integer> clientStopIdxs = new LinkedBlockingQueue<>();
-
-            for (int i = GRID_CNT; i < GRID_CNT + CLIENT_GRID_CNT; i++)
-                clientStopIdxs.add(i);
+            if (clients) {
+                clientFlagGlobal = true;
 
-            final AtomicInteger clientStartIdx = new AtomicInteger(9000);
+                startGridsMultiThreaded(GRID_CNT, CLIENT_GRID_CNT);
 
-            IgniteInternalFuture<?> fut1 = multithreadedAsync(
-                new Callable<Object>() {
-                    @Override public Object call() throws Exception {
-                        try {
-                            clientFlagPerThread.set(true);
+                final BlockingQueue<Integer> clientStopIdxs = new LinkedBlockingQueue<>();
 
-                            while (!done.get() && error.get() == null) {
-                                Integer stopIdx = clientStopIdxs.take();
+                for (int i = GRID_CNT; i < GRID_CNT + CLIENT_GRID_CNT; i++)
+                    clientStopIdxs.add(i);
 
-                                log.info("Stop client: " + stopIdx);
+                final AtomicInteger clientStartIdx = new AtomicInteger(9000);
 
-                                stopGrid(stopIdx);
+                clientFut = multithreadedAsync(
+                    new Callable<Object>() {
+                        @Override public Object call() throws Exception {
+                            try {
+                                clientFlagPerThread.set(true);
 
                                 while (!done.get() && error.get() == null) {
-                                    // Generate unique name to simplify debugging.
-                                    int startIdx = clientStartIdx.getAndIncrement();
+                                    Integer stopIdx = clientStopIdxs.take();
 
-                                    log.info("Start client: " + startIdx);
+                                    log.info("Stop client: " + stopIdx);
 
-                                    UUID id = UUID.randomUUID();
+                                    stopGrid(stopIdx);
 
-                                    nodeId.set(id);
+                                    while (!done.get() && error.get() == null) {
+                                        // Generate unique name to simplify debugging.
+                                        int startIdx = clientStartIdx.getAndIncrement();
 
-                                    try {
-                                        Ignite ignite = startGrid(startIdx);
+                                        log.info("Start client: " + startIdx);
 
-                                        assertTrue(ignite.configuration().isClientMode());
+                                        UUID id = UUID.randomUUID();
 
-                                        clientStopIdxs.add(startIdx);
+                                        nodeId.set(id);
 
-                                        break;
-                                    }
-                                    catch (Exception e) {
-                                        if (X.hasCause(e, IgniteClientDisconnectedCheckedException.class)
||
-                                            X.hasCause(e, IgniteClientDisconnectedException.class))
-                                            log.info("Client disconnected: " + e);
-                                        else if (X.hasCause(e, ClusterTopologyCheckedException.class))
-                                            log.info("Client failed to start: " + e);
-                                        else {
-                                            if (failedNodes.contains(id) && X.hasCause(e,
IgniteSpiException.class))
-                                                log.info("Client failed: " + e);
-                                            else
-                                                throw e;
+                                        try {
+                                            Ignite ignite = startGrid(startIdx);
+
+                                            assertTrue(ignite.configuration().isClientMode());
+
+                                            clientStopIdxs.add(startIdx);
+
+                                            break;
+                                        }
+                                        catch (Exception e) {
+                                            if (X.hasCause(e, IgniteClientDisconnectedCheckedException.class)
||
+                                                X.hasCause(e, IgniteClientDisconnectedException.class))
+                                                log.info("Client disconnected: " + e);
+                                            else if (X.hasCause(e, ClusterTopologyCheckedException.class))
+                                                log.info("Client failed to start: " + e);
+                                            else {
+                                                if (failedNodes.contains(id) && X.hasCause(e,
IgniteSpiException.class))
+                                                    log.info("Client failed: " + e);
+                                                else
+                                                    throw e;
+                                            }
                                         }
                                     }
                                 }
                             }
-                        }
-                        catch (Throwable e) {
-                            log.error("Unexpected error: " + e, e);
+                            catch (Throwable e) {
+                                log.error("Unexpected error: " + e, e);
 
-                            error.compareAndSet(null, e);
+                                error.compareAndSet(null, e);
+
+                                return null;
+                            }
 
                             return null;
                         }
-
-                        return null;
-                    }
-                },
-                CLIENT_GRID_CNT,
-                "client-restart");
+                    },
+                    CLIENT_GRID_CNT,
+                    "client-restart");
+            }
 
             final BlockingQueue<Integer> srvStopIdxs = new LinkedBlockingQueue<>();
 
@@ -303,7 +322,7 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest
{
 
             final AtomicInteger srvStartIdx = new AtomicInteger(GRID_CNT + CLIENT_GRID_CNT);
 
-            IgniteInternalFuture<?> fut2 = multithreadedAsync(
+            IgniteInternalFuture<?> srvFut = multithreadedAsync(
                 new Callable<Object>() {
                     @Override public Object call() throws Exception {
                         try {
@@ -356,8 +375,10 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest
{
 
                     done.set(true);
 
-                    fut1.cancel();
-                    fut2.cancel();
+                    if (clientFut != null)
+                        clientFut.cancel();
+
+                    srvFut.cancel();
 
                     throw err;
                 }
@@ -367,8 +388,10 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest
{
 
             done.set(true);
 
-            fut1.get();
-            fut2.get();
+            if (clientFut != null)
+                clientFut.get();
+
+            srvFut.get();
         }
         finally {
             done.set(true);
@@ -402,7 +425,7 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest
{
     /**
      * @throws Exception If any error occurs.
      */
-    public void testMultipleStartOnCoordinatorStop() throws Exception{
+    public void _testMultipleStartOnCoordinatorStop() throws Exception{
         for (int k = 0; k < 3; k++) {
             log.info("Iteration: " + k);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/68fcd281/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiTestSuite.java
index fc4023a..fb05d01 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiTestSuite.java
@@ -19,6 +19,7 @@ package org.apache.ignite.testsuites;
 
 import junit.framework.TestSuite;
 import org.apache.ignite.internal.managers.GridNoopManagerSelfTest;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoveryMultiThreadedTest;
 
 /**
  * Grid SPI test suite.
@@ -31,38 +32,8 @@ public class IgniteSpiTestSuite extends TestSuite {
     public static TestSuite suite() throws Exception {
         TestSuite suite = new TestSuite("Ignite SPIs Test Suite");
 
-        // Failover.
-        suite.addTest(IgniteSpiFailoverSelfTestSuite.suite());
-
-        // Collision.
-        suite.addTest(IgniteSpiCollisionSelfTestSuite.suite());
-
-        // Event storage.
-        suite.addTest(IgniteSpiEventStorageSelfTestSuite.suite());
-
-        // Load Balancing.
-        suite.addTest(IgniteSpiLoadBalancingSelfTestSuite.suite());
-
-        // Swap space.
-        suite.addTest(IgniteSpiSwapSpaceSelfTestSuite.suite());
-
-        // Checkpoints.
-        suite.addTest(IgniteSpiCheckpointSelfTestSuite.suite());
-
-        // Deployment
-        suite.addTest(IgniteSpiDeploymentSelfTestSuite.suite());
-
-        // Discovery.
-        suite.addTest(IgniteSpiDiscoverySelfTestSuite.suite());
-
-        // Communication.
-        suite.addTest(IgniteSpiCommunicationSelfTestSuite.suite());
-
-        // Indexing.
-        suite.addTest(IgniteSpiIndexingSelfTestSuite.suite());
-
         // All other tests.
-        suite.addTestSuite(GridNoopManagerSelfTest.class);
+        suite.addTestSuite(TcpDiscoveryMultiThreadedTest.class);
 
         return suite;
     }


Mime
View raw message