akka.actor.provider set to 'cluster' 33/98733/5
authorDominik Vrbovsky <dominik.vrbovsky@pantheon.tech>
Mon, 6 Dec 2021 17:05:03 +0000 (18:05 +0100)
committerDominik Vrbovsky <dominik.vrbovsky@pantheon.tech>
Mon, 6 Dec 2021 17:05:03 +0000 (18:05 +0100)
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 <dominik.vrbovsky@pantheon.tech>
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorRecoverySupportTest.java
opendaylight/md-sal/sal-akka-raft/src/test/resources/application.conf
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/mbeans/RemoteActionRegistryMXBeanImplTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/mbeans/RemoteRpcRegistryMXBeanImplTest.java

index 76571137c1451863de949a6b070b54c965ba1add..3e66c708dd25dc411979b0d238650624199b59b0 100644 (file)
@@ -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);
     }
index b997326238b91e76c0cd2e6b19c60f14dd889de0..d7ae0cb29fd2cee152430b001e49f1b6dcb82d9a 100644 (file)
@@ -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
 
index b9376520a5134814e821872843fe3b11d4b97f8d..7ac18e61dc146a6b27430c884864c39ffe8620d5 100644 (file)
@@ -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());
index 1a76aa6f9c1d8c82c4a02685a568e57afd84cb1f..18b443d8fd9deb3028690387e5479e9bad90d502 100644 (file)
@@ -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());
index 6421750e0d38a19b51080d6134713d81d8cad032..282b7b5ee49371df7884a9002f5e50c581e8efec 100644 (file)
@@ -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());