ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sevdoki...@apache.org
Subject [28/51] [abbrv] incubator-ignite git commit: #sprint-1: GridServiceReassignmentSelfTest delay more 500.
Date Tue, 10 Feb 2015 08:16:52 GMT
#sprint-1: GridServiceReassignmentSelfTest delay more 500.


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

Branch: refs/heads/ignite-96-tests
Commit: 148753c03813f45ddd66cdc1d5587b2a809ba034
Parents: 2e8ff3d
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Mon Feb 9 16:09:28 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Mon Feb 9 16:09:28 2015 +0300

----------------------------------------------------------------------
 .../service/GridServiceReassignmentSelfTest.java   | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/148753c0/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceReassignmentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceReassignmentSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceReassignmentSelfTest.java
index a9e0d7b..326554b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceReassignmentSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceReassignmentSelfTest.java
@@ -122,9 +122,12 @@ public class GridServiceReassignmentSelfTest extends GridServiceProcessorAbstrac
                         grow = true;
                 }
 
-                U.sleep(2000);
+                for (int attempt = 0; attempt <= 10; ++attempt) {
+                    U.sleep(500);
 
-                checkServices(total, maxPerNode, F.first(startedGrids));
+                    if (checkServices(total, maxPerNode, F.first(startedGrids), attempt ==
10))
+                        break;
+                }
             }
         }
         finally {
@@ -144,7 +147,7 @@ public class GridServiceReassignmentSelfTest extends GridServiceProcessorAbstrac
      * @param gridIdx Grid index to check.
      * @throws Exception If failed.
      */
-    private void checkServices(int total, int maxPerNode, int gridIdx) throws Exception {
+    private boolean checkServices(int total, int maxPerNode, int gridIdx, boolean lastTry)
throws Exception {
         IgniteEx grid = grid(gridIdx);
 
         GridCacheProjectionEx<GridServiceAssignmentsKey, GridServiceAssignments> cache
= grid.
@@ -161,6 +164,9 @@ public class GridServiceReassignmentSelfTest extends GridServiceProcessorAbstrac
         for (Map.Entry<UUID, Integer> entry : assignments.assigns().entrySet()) {
             UUID nodeId = entry.getKey();
 
+            if (!lastTry && !nodes.contains(nodeId))
+                return false;
+
             assertTrue("Dead node is in assignments: " + nodeId, nodes.contains(nodeId));
 
             Integer nodeCnt = entry.getValue();
@@ -176,7 +182,12 @@ public class GridServiceReassignmentSelfTest extends GridServiceProcessorAbstrac
             assertTrue("Total number of services limit exceeded [sum=" + sum +
                 ", assigns=" + assignments.assigns() + ']', sum <= total);
 
+        if (!lastTry && proxy(grid).get() != 10)
+            return false;
+
         assertEquals(10, proxy(grid).get());
+
+        return true;
     }
 
     /**


Mime
View raw message