513fa1aa16
Comment/XML-doc changes only: - add summaries to ~10k test methods, fixtures, fakes and helpers (+ <param> on theories, <returns> on async Task methods, <inheritdoc/> on interface implementations the checker can resolve) - strip ~2.6k project-tracking references (WP*, P*-*, row-NN, Task N, #NN, Component-0NN) from comments, keeping the explanatory text; reword false positives in comments only - real docs on fakes implementing BCL/library interfaces (IDisposable, ILogger, IOptionsMonitor, IAsyncLifetime) - reword the last 5 src/ false positives (CWE-1236, failures-1, year-0001, M365) Only non-comment edits: four one-line nested classes split across lines so members can carry docs. Build 0 errors / 0 warnings.
84 lines
2.2 KiB
C#
84 lines
2.2 KiB
C#
using Akka.Actor;
|
|
using Akka.Configuration;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.Host.Tests;
|
|
|
|
/// <summary>
|
|
/// Tests for Akka.NET actor system bootstrap.
|
|
/// </summary>
|
|
public class AkkaBootstrapTests : IDisposable
|
|
{
|
|
private ActorSystem? _actorSystem;
|
|
|
|
/// <summary>Releases the resources held by this test class.</summary>
|
|
public void Dispose()
|
|
{
|
|
_actorSystem?.Dispose();
|
|
}
|
|
|
|
/// <summary>Verifies that the actor system is created with the cluster configuration.</summary>
|
|
[Fact]
|
|
public void ActorSystem_CreatesWithClusterConfig()
|
|
{
|
|
var hocon = @"
|
|
akka {
|
|
actor {
|
|
provider = cluster
|
|
}
|
|
remote {
|
|
dot-netty.tcp {
|
|
hostname = ""localhost""
|
|
port = 0
|
|
}
|
|
}
|
|
cluster {
|
|
seed-nodes = [""akka.tcp://scadabridge-test@localhost:0""]
|
|
roles = [""Central""]
|
|
min-nr-of-members = 1
|
|
}
|
|
coordinated-shutdown {
|
|
run-by-clr-shutdown-hook = on
|
|
}
|
|
}";
|
|
var config = ConfigurationFactory.ParseString(hocon);
|
|
_actorSystem = ActorSystem.Create("scadabridge-test", config);
|
|
|
|
Assert.NotNull(_actorSystem);
|
|
Assert.Equal("scadabridge-test", _actorSystem.Name);
|
|
}
|
|
|
|
/// <summary>Verifies that the HOCON configuration includes coordinated shutdown.</summary>
|
|
[Fact]
|
|
public void ActorSystem_HoconConfig_IncludesCoordinatedShutdown()
|
|
{
|
|
var hocon = @"
|
|
akka {
|
|
actor {
|
|
provider = cluster
|
|
}
|
|
remote {
|
|
dot-netty.tcp {
|
|
hostname = ""localhost""
|
|
port = 0
|
|
}
|
|
}
|
|
cluster {
|
|
seed-nodes = [""akka.tcp://scadabridge-test@localhost:0""]
|
|
roles = [""Central""]
|
|
run-coordinated-shutdown-when-down = on
|
|
}
|
|
coordinated-shutdown {
|
|
run-by-clr-shutdown-hook = on
|
|
}
|
|
}";
|
|
var config = ConfigurationFactory.ParseString(hocon);
|
|
_actorSystem = ActorSystem.Create("scadabridge-cs-test", config);
|
|
|
|
var csConfig = _actorSystem.Settings.Config.GetString("akka.coordinated-shutdown.run-by-clr-shutdown-hook");
|
|
Assert.Equal("on", csConfig);
|
|
|
|
var clusterShutdown = _actorSystem.Settings.Config.GetString("akka.cluster.run-coordinated-shutdown-when-down");
|
|
Assert.Equal("on", clusterShutdown);
|
|
}
|
|
}
|