X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2FAbstractRaftActorIntegrationTest.java;h=a47cf118963e1698c68ef2c2706a44c2baaeeb59;hb=eac2d5f506b801fcac619ca2cb7e4dcd85489a08;hp=977cf0ef5eb60fc905ef7ce35177b46d23ed265b;hpb=f96b3f1dfbd6e4a220caa84b24134600b17952ca;p=controller.git diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/AbstractRaftActorIntegrationTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/AbstractRaftActorIntegrationTest.java index 977cf0ef5e..a47cf11896 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/AbstractRaftActorIntegrationTest.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/AbstractRaftActorIntegrationTest.java @@ -8,7 +8,9 @@ package org.opendaylight.controller.cluster.raft; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import akka.actor.ActorRef; +import akka.actor.InvalidActorNameException; import akka.actor.PoisonPill; import akka.actor.Props; import akka.actor.Terminated; @@ -19,6 +21,7 @@ import com.google.common.base.Optional; import com.google.common.base.Predicate; import com.google.common.base.Supplier; import com.google.common.collect.ImmutableMap; +import com.google.common.util.concurrent.Uninterruptibles; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -186,9 +189,21 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest TestActorRef collectorActor = factory.createTestActor( MessageCollectorActor.props().withDispatcher(Dispatchers.DefaultDispatcherId()), factory.generateActorId(id + "-collector")); - return factory.createTestActor(TestRaftActor.props(id, - peerAddresses != null ? peerAddresses : Collections.emptyMap(), - configParams, collectorActor), id); + + InvalidActorNameException lastEx = null; + for(int i = 0; i < 10; i++) { + try { + return factory.createTestActor(TestRaftActor.props(id, + peerAddresses != null ? peerAddresses : Collections.emptyMap(), + configParams, collectorActor), id); + } catch (InvalidActorNameException e) { + lastEx = e; + Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS); + } + } + + assertNotNull(lastEx); + throw lastEx; } protected void killActor(TestActorRef leaderActor) {