Files
scadalink-design/tests/ScadaLink.ClusterInfrastructure.Tests/ClusterOptionsTests.cs
Joseph Doherty 7740a3bcf9 feat: add JoeAppEngine OPC UA nodes, fix DCL auto-reconnect and quality push
- Add JoeAppEngine folder to OPC UA nodes.json (BTCS, AlarmCntsBySeverity, Scheduler/ScanTime)
- Fix DataConnectionActor: capture Self in PreStart for use from non-actor threads,
  preventing Self.Tell failure in Disconnected event handler
- Implement InstanceActor.HandleConnectionQualityChanged to mark attributes Bad on disconnect
- Fix LmxFakeProxy TagMapper to serialize arrays as JSON instead of "System.Int32[]"
- Allow DataType and DataSourceReference updates in TemplateService.UpdateAttributeAsync
- Update test_infra_opcua.md with JoeAppEngine documentation
2026-03-19 13:27:54 -04:00

52 lines
1.9 KiB
C#

namespace ScadaLink.ClusterInfrastructure.Tests;
/// <summary>
/// Tests for ClusterOptions default values and property setters.
/// </summary>
public class ClusterOptionsTests
{
[Fact]
public void DefaultValues_AreCorrect()
{
var options = new ClusterOptions();
Assert.Equal("keep-oldest", options.SplitBrainResolverStrategy);
Assert.Equal(TimeSpan.FromSeconds(15), options.StableAfter);
Assert.Equal(TimeSpan.FromSeconds(2), options.HeartbeatInterval);
Assert.Equal(TimeSpan.FromSeconds(10), options.FailureDetectionThreshold);
Assert.Equal(1, options.MinNrOfMembers);
}
[Fact]
public void SeedNodes_DefaultsToEmptyList()
{
var options = new ClusterOptions();
Assert.NotNull(options.SeedNodes);
Assert.Empty(options.SeedNodes);
}
[Fact]
public void Properties_CanBeSetToCustomValues()
{
var options = new ClusterOptions
{
SeedNodes = new List<string> { "akka.tcp://system@node1:2551", "akka.tcp://system@node2:2551" },
SplitBrainResolverStrategy = "keep-majority",
StableAfter = TimeSpan.FromSeconds(30),
HeartbeatInterval = TimeSpan.FromSeconds(5),
FailureDetectionThreshold = TimeSpan.FromSeconds(20),
MinNrOfMembers = 2
};
Assert.Equal(2, options.SeedNodes.Count);
Assert.Contains("akka.tcp://system@node1:2551", options.SeedNodes);
Assert.Contains("akka.tcp://system@node2:2551", options.SeedNodes);
Assert.Equal("keep-majority", options.SplitBrainResolverStrategy);
Assert.Equal(TimeSpan.FromSeconds(30), options.StableAfter);
Assert.Equal(TimeSpan.FromSeconds(5), options.HeartbeatInterval);
Assert.Equal(TimeSpan.FromSeconds(20), options.FailureDetectionThreshold);
Assert.Equal(2, options.MinNrOfMembers);
}
}