From: Dominik Vrbovsky Date: Mon, 6 Dec 2021 17:05:03 +0000 (+0100) Subject: akka.actor.provider set to 'cluster' X-Git-Tag: v4.0.8~12 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=30eb37d8cde5a8d35e36aa38e0bab1232b242de2 akka.actor.provider set to 'cluster' A number of sal-akka-raft test logs are polluted by ConfigurationException. ActorSystem needs to have 'akka.actor.provider' set to 'cluster' in the configuration. JIRA: CONTROLLER-2023 Change-Id: If6e873864ffe0ea8261c80c233b6d40459d05164 Signed-off-by: Dominik Vrbovsky --- diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorRecoverySupportTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorRecoverySupportTest.java index 76571137c1..3e66c708dd 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorRecoverySupportTest.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorRecoverySupportTest.java @@ -25,6 +25,7 @@ import akka.actor.Props; import akka.persistence.RecoveryCompleted; import akka.persistence.SnapshotMetadata; import akka.persistence.SnapshotOffer; +import akka.testkit.javadsl.TestKit; import com.google.common.util.concurrent.MoreExecutors; import java.io.OutputStream; import java.util.List; @@ -38,6 +39,7 @@ import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; +import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -107,6 +109,11 @@ public class RaftActorRecoverySupportTest { context.setReplicatedLog(ReplicatedLogImpl.newInstance(context)); } + @After + public void tearDown() { + TestKit.shutdownActorSystem(mockActorSystem); + } + private void sendMessageToSupport(final Object message) { sendMessageToSupport(message, false); } diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/resources/application.conf b/opendaylight/md-sal/sal-akka-raft/src/test/resources/application.conf index b997326238..d7ae0cb29f 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/resources/application.conf +++ b/opendaylight/md-sal/sal-akka-raft/src/test/resources/application.conf @@ -6,6 +6,8 @@ akka { loggers = ["akka.testkit.TestEventListener", "akka.event.slf4j.Slf4jLogger"] actor { + provider = "akka.cluster.ClusterActorRefProvider" + # enable to test serialization only. serialize-messages = off diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java index b9376520a5..7ac18e61dc 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java @@ -239,8 +239,8 @@ public class ShardTest extends AbstractShardTest { CreateTransactionReply.class); final String path = reply.getTransactionPath().toString(); - assertTrue("Unexpected transaction path " + path, path.startsWith(String.format( - "akka://test/user/testCreateTransaction/shard-%s-%s:ShardTransactionTest@0:", + assertTrue("Unexpected transaction path " + path, path.contains(String.format( + "/user/testCreateTransaction/shard-%s-%s:ShardTransactionTest@0:", shardID.getShardName(), shardID.getMemberName().getName()))); } @@ -258,8 +258,8 @@ public class ShardTest extends AbstractShardTest { CreateTransactionReply.class); final String path = reply.getTransactionPath().toString(); - assertTrue("Unexpected transaction path " + path, path.startsWith(String.format( - "akka://test/user/testCreateTransactionOnChain/shard-%s-%s:ShardTransactionTest@0:", + assertTrue("Unexpected transaction path " + path, path.contains(String.format( + "/user/testCreateTransactionOnChain/shard-%s-%s:ShardTransactionTest@0:", shardID.getShardName(), shardID.getMemberName().getName()))); } @@ -478,7 +478,9 @@ public class ShardTest extends AbstractShardTest { ImmutableNodes.containerNode(TestModel.TEST_QNAME), false), testKit.getRef()); final ReadyTransactionReply readyReply = ReadyTransactionReply .fromSerializable(testKit.expectMsgClass(duration, ReadyTransactionReply.class)); - assertEquals("Cohort path", shard.path().toString(), readyReply.getCohortPath()); + + String pathSuffix = shard.path().toString().replaceFirst("akka://test", ""); + assertTrue("Cohort path", readyReply.getCohortPath().endsWith(pathSuffix)); // Send the CanCommitTransaction message for the first Tx. shard.tell(new CanCommitTransaction(transactionID1, CURRENT_VERSION).toSerializable(), testKit.getRef()); diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/mbeans/RemoteActionRegistryMXBeanImplTest.java b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/mbeans/RemoteActionRegistryMXBeanImplTest.java index 1a76aa6f9c..18b443d8fd 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/mbeans/RemoteActionRegistryMXBeanImplTest.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/mbeans/RemoteActionRegistryMXBeanImplTest.java @@ -15,6 +15,7 @@ import akka.testkit.TestActorRef; import akka.testkit.javadsl.TestKit; import akka.util.Timeout; import com.google.common.collect.Lists; +import com.typesafe.config.ConfigFactory; import java.util.Collections; import java.util.List; import java.util.Map; @@ -47,7 +48,7 @@ public class RemoteActionRegistryMXBeanImplTest { @Before public void setUp() { - system = ActorSystem.create("test"); + system = ActorSystem.create("test", ConfigFactory.load().getConfig("unit-test")); final DOMActionInstance emptyActionIdentifier = DOMActionInstance.of( REMOTE_SCHEMA_PATH, LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.empty()); diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/mbeans/RemoteRpcRegistryMXBeanImplTest.java b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/mbeans/RemoteRpcRegistryMXBeanImplTest.java index 6421750e0d..282b7b5ee4 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/mbeans/RemoteRpcRegistryMXBeanImplTest.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/mbeans/RemoteRpcRegistryMXBeanImplTest.java @@ -21,6 +21,7 @@ import akka.testkit.TestActorRef; import akka.testkit.javadsl.TestKit; import akka.util.Timeout; import com.google.common.collect.Lists; +import com.typesafe.config.ConfigFactory; import java.util.Collections; import java.util.List; import java.util.Map; @@ -47,7 +48,7 @@ public class RemoteRpcRegistryMXBeanImplTest { @Before public void setUp() { - system = ActorSystem.create("test"); + system = ActorSystem.create("test", ConfigFactory.load().getConfig("unit-test")); final DOMRpcIdentifier emptyRpcIdentifier = DOMRpcIdentifier.create( REMOTE_QNAME, YangInstanceIdentifier.empty());