Skip to content

Commit

Permalink
#sprint-1: GridServiceReassignmentSelfTest delay more 500.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivasilinets committed Feb 9, 2015
1 parent 2e8ff3d commit 148753c
Showing 1 changed file with 14 additions and 3 deletions.
Expand Up @@ -122,9 +122,12 @@ private void checkReassigns(int total, int maxPerNode) throws Exception {
grow = true; 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 { finally {
Expand All @@ -144,7 +147,7 @@ private void checkReassigns(int total, int maxPerNode) throws Exception {
* @param gridIdx Grid index to check. * @param gridIdx Grid index to check.
* @throws Exception If failed. * @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); IgniteEx grid = grid(gridIdx);


GridCacheProjectionEx<GridServiceAssignmentsKey, GridServiceAssignments> cache = grid. GridCacheProjectionEx<GridServiceAssignmentsKey, GridServiceAssignments> cache = grid.
Expand All @@ -161,6 +164,9 @@ private void checkServices(int total, int maxPerNode, int gridIdx) throws Except
for (Map.Entry<UUID, Integer> entry : assignments.assigns().entrySet()) { for (Map.Entry<UUID, Integer> entry : assignments.assigns().entrySet()) {
UUID nodeId = entry.getKey(); UUID nodeId = entry.getKey();


if (!lastTry && !nodes.contains(nodeId))
return false;

assertTrue("Dead node is in assignments: " + nodeId, nodes.contains(nodeId)); assertTrue("Dead node is in assignments: " + nodeId, nodes.contains(nodeId));


Integer nodeCnt = entry.getValue(); Integer nodeCnt = entry.getValue();
Expand All @@ -176,7 +182,12 @@ private void checkServices(int total, int maxPerNode, int gridIdx) throws Except
assertTrue("Total number of services limit exceeded [sum=" + sum + assertTrue("Total number of services limit exceeded [sum=" + sum +
", assigns=" + assignments.assigns() + ']', sum <= total); ", assigns=" + assignments.assigns() + ']', sum <= total);


if (!lastTry && proxy(grid).get() != 10)
return false;

assertEquals(10, proxy(grid).get()); assertEquals(10, proxy(grid).get());

return true;
} }


/** /**
Expand Down

0 comments on commit 148753c

Please sign in to comment.