You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/06/16 13:54:36 UTC

incubator-ignite git commit: # ignite-sprint-6 tests fixes

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-sprint-6 3423ed363 -> 5b9013f60


# ignite-sprint-6 tests fixes


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

Branch: refs/heads/ignite-sprint-6
Commit: 5b9013f60af4b86a8d4362890a54d6eaaa159441
Parents: 3423ed3
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 16 14:54:23 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 16 14:54:23 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/internal/GridSelfTest.java     | 12 +++++++++---
 .../cache/GridCacheAbstractFailoverSelfTest.java     |  2 ++
 ...gniteCacheP2pUnmarshallingRebalanceErrorTest.java | 15 ++++++---------
 .../junits/common/GridCommonAbstractTest.java        | 11 +++++++----
 4 files changed, 24 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5b9013f6/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
index 7f5ee54..eccae34 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
@@ -19,8 +19,10 @@ package org.apache.ignite.internal;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cluster.*;
+import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.messaging.*;
+import org.apache.ignite.testframework.*;
 import org.apache.ignite.testframework.junits.common.*;
 
 import java.util.*;
@@ -112,7 +114,7 @@ public class GridSelfTest extends GridProjectionAbstractTest {
     public void testAsyncListen() throws Exception {
         final String msg = "HELLO!";
 
-        Ignite g = grid(0);
+        final Ignite g = grid(0);
 
         final UUID locNodeId = g.cluster().localNode().id();
 
@@ -138,9 +140,13 @@ public class GridSelfTest extends GridProjectionAbstractTest {
 
         g.message().send(null, msg);
 
-        Thread.sleep(1000);
+        GridTestUtils.waitForCondition(new GridAbsPredicate() {
+            @Override public boolean apply() {
+                return cnt.get() == g.cluster().forRemotes().nodes().size();
+            }
+        }, 5000);
 
-        assert cnt.get() == g.cluster().forRemotes().nodes().size();
+        assertEquals(cnt.get(), g.cluster().forRemotes().nodes().size());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5b9013f6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
index 6b7d1b8..b6cd88e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
@@ -68,6 +68,8 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
+        cfg.setNetworkTimeout(60_000);
+
         cfg.getTransactionConfiguration().setTxSerializableEnabled(true);
 
         TcpDiscoverySpi discoSpi = (TcpDiscoverySpi)cfg.getDiscoverySpi();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5b9013f6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingRebalanceErrorTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingRebalanceErrorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingRebalanceErrorTest.java
index 49f58f9..a37f585 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingRebalanceErrorTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingRebalanceErrorTest.java
@@ -34,12 +34,11 @@ public class IgniteCacheP2pUnmarshallingRebalanceErrorTest extends IgniteCacheP2
 
     /** {@inheritDoc} */
     @Override public void testResponseMessageOnUnmarshallingFailed() throws Exception {
-        //GridDhtPartitionSupplyMessage unmarshalling failed test
+        //GridDhtPartitionSupplyMessage unmarshalling failed test.
         readCnt.set(Integer.MAX_VALUE);
 
-        for (int i = 0; i <= 20; i++) {
+        for (int i = 0; i <= 20; i++)
             jcache(0).put(new TestKey(String.valueOf(++key)), "");
-        }
 
         readCnt.set(1);
 
@@ -49,32 +48,30 @@ public class IgniteCacheP2pUnmarshallingRebalanceErrorTest extends IgniteCacheP2
 
         Thread.sleep(1000);
 
-        //GridDhtForceKeysRequest unmarshalling failed test
+        //GridDhtForceKeysRequest unmarshalling failed test.
         stopGrid(3);
 
         readCnt.set(Integer.MAX_VALUE);
 
-        for (int i = 0; i <= 1000; i++) {
+        for (int i = 0; i <= 1000; i++)
             jcache(0).put(new TestKey(String.valueOf(++key)), "");
-        }
 
         startGrid(3);
 
         Affinity<Object> aff = affinity(grid(3).cache(null));
 
-        while (!aff.isPrimary(grid(3).localNode(), new TestKey(String.valueOf(key)))) {
+        while (!aff.isPrimary(grid(3).localNode(), new TestKey(String.valueOf(key))))
             --key;
-        }
 
         readCnt.set(1);
 
         try {
             jcache(3).get(new TestKey(String.valueOf(key)));
+
             assert false : "p2p marshalling failed, but error response was not sent";
         }
         catch (CacheException e) {
             assert X.hasCause(e, IOException.class);
         }
-
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5b9013f6/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index d3535b4..bc33746 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -336,14 +336,14 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
 
     /**
      * @param cnt Count.
-     * @param awaitPartitionMapExchange If we need to await partition map exchange.
+     * @param awaitPartMapExchange If we need to await partition map exchange.
      * @return Ignite.
      * @throws Exception If failed.
      */
-    protected final Ignite startGridsMultiThreaded(int cnt, boolean awaitPartitionMapExchange) throws Exception {
+    protected final Ignite startGridsMultiThreaded(int cnt, boolean awaitPartMapExchange) throws Exception {
         Ignite g = super.startGridsMultiThreaded(cnt);
 
-        if (awaitPartitionMapExchange)
+        if (awaitPartMapExchange)
             awaitPartitionMapExchange();
 
         return g;
@@ -379,7 +379,8 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
 
                             int exp = affNodes.size();
 
-                            Collection<ClusterNode> owners = top.nodes(p, AffinityTopologyVersion.NONE);
+                            Collection<ClusterNode> owners = top.topologyVersion() == AffinityTopologyVersion.NONE ?
+                                Collections.<ClusterNode>emptyList() : top.nodes(p, AffinityTopologyVersion.NONE);
 
                             int actual = owners.size();
 
@@ -388,6 +389,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
                                     "grid=" + g.name() +
                                     ", cache=" + cfg.getName() +
                                     ", cacheId=" + dht.context().cacheId() +
+                                    ", topVer=" + top.topologyVersion() +
                                     ", p=" + p +
                                     ", affNodesCnt=" + exp +
                                     ", ownersCnt=" + actual +
@@ -403,6 +405,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
                                         "grid=" + g.name() +
                                         ", cache=" + cfg.getName() +
                                         ", cacheId=" + dht.context().cacheId() +
+                                        ", topVer=" + top.topologyVersion() +
                                         ", p=" + p +
                                         ", affNodesCnt=" + exp +
                                         ", ownersCnt=" + actual +