test(controlplane): self-join cluster + DistributedPubSub extension in test harness
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using Akka.Cluster;
|
||||
using Akka.TestKit.Xunit2;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ZB.MOM.WW.OtOpcUa.Configuration;
|
||||
@@ -18,6 +19,9 @@ public abstract class ControlPlaneActorTestBase : TestKit
|
||||
protected static string AkkaTestHocon => @"
|
||||
akka {
|
||||
loglevel = ""WARNING""
|
||||
extensions = [
|
||||
""Akka.Cluster.Tools.PublishSubscribe.DistributedPubSubExtensionProvider, Akka.Cluster.Tools""
|
||||
]
|
||||
actor {
|
||||
provider = ""Akka.Cluster.ClusterActorRefProvider, Akka.Cluster""
|
||||
}
|
||||
@@ -30,10 +34,18 @@ akka {
|
||||
roles = [""admin""]
|
||||
min-nr-of-members = 1
|
||||
run-coordinated-shutdown-when-down = off
|
||||
pub-sub.role = """"
|
||||
}
|
||||
}";
|
||||
|
||||
protected ControlPlaneActorTestBase() : base(AkkaTestHocon) { }
|
||||
protected ControlPlaneActorTestBase() : base(AkkaTestHocon)
|
||||
{
|
||||
// Self-join so the cluster transitions to Up and DistributedPubSub forms.
|
||||
var cluster = Akka.Cluster.Cluster.Get(Sys);
|
||||
cluster.Join(cluster.SelfAddress);
|
||||
AwaitCondition(() => cluster.State.Members.Any(m => m.Status == MemberStatus.Up),
|
||||
TimeSpan.FromSeconds(5));
|
||||
}
|
||||
|
||||
protected static IDbContextFactory<OtOpcUaConfigDbContext> NewInMemoryDbFactory(string? dbName = null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user