Skip to content

Commit

Permalink
GG-21057 Fixed IgniteCacheReplicatedQuerySelfTest.testNodeLeft flaky …
Browse files Browse the repository at this point in the history
…failed on TC
  • Loading branch information
dgovorukhin committed Jul 8, 2019
1 parent 591b169 commit fe0ec74
Showing 1 changed file with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,12 @@ public void testLostIterator() throws Exception {
*/
@Test
public void testNodeLeft() throws Exception {
Ignite g = startGrid("client");
Ignite client = startGrid("client");

try {
assertTrue(g.configuration().isClientMode());
assertTrue(client.configuration().isClientMode());

IgniteCache<Integer, Integer> cache = jcache(g, Integer.class, Integer.class);
IgniteCache<Integer, Integer> cache = jcache(client, Integer.class, Integer.class);

for (int i = 0; i < 1000; i++)
cache.put(i, i);
Expand All @@ -380,18 +380,21 @@ public void testNodeLeft() throws Exception {

assertEquals(1, mapNode1.size() + mapNode2.size() + mapNode3.size());

final UUID nodeId = g.cluster().localNode().id();
final UUID nodeId = client.cluster().localNode().id();

final CountDownLatch latch = new CountDownLatch(1);
final CountDownLatch latch = new CountDownLatch(3);

grid(0).events().localListen(new IgnitePredicate<Event>() {
@Override public boolean apply(Event evt) {
if (((DiscoveryEvent)evt).eventNode().id().equals(nodeId))
latch.countDown();
// Add listeners on all nodes.
for (int i = 0; i < 3; i++) {
grid(i).events().localListen(new IgnitePredicate<Event>() {
@Override public boolean apply(Event evt) {
if (((DiscoveryEvent)evt).eventNode().id().equals(nodeId))
latch.countDown();

return true;
}
}, EVT_NODE_LEFT, EVT_NODE_FAILED);
return true;
}
}, EVT_NODE_LEFT, EVT_NODE_FAILED);
}

stopGrid("client");

Expand Down

0 comments on commit fe0ec74

Please sign in to comment.