Surface historian plugin and alarm-tracking health in the status dashboard so operators can detect misconfiguration and runtime degradation that previously showed as fully healthy
Wraps the 4 HistoryRead overrides and OnAlarmAcknowledge with PerformanceMetrics.BeginOperation, adds alarm counters to LmxNodeManager, publishes a structured HistorianPluginOutcome from HistorianPluginLoader, and extends HealthCheckService with plugin-load, history-read, and alarm-ack-failure degradation rules. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
using ZB.MOM.WW.LmxOpcUa.Host.Configuration;
|
||||
using ZB.MOM.WW.LmxOpcUa.Host.Historian;
|
||||
|
||||
namespace ZB.MOM.WW.LmxOpcUa.Tests.Historian
|
||||
{
|
||||
/// <summary>
|
||||
/// Verifies the load-outcome state machine of <see cref="HistorianPluginLoader"/>.
|
||||
/// </summary>
|
||||
public class HistorianPluginLoaderTests
|
||||
{
|
||||
/// <summary>
|
||||
/// MarkDisabled publishes a Disabled outcome so the dashboard can distinguish
|
||||
/// "feature off" from "load failed."
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void MarkDisabled_PublishesDisabledOutcome()
|
||||
{
|
||||
HistorianPluginLoader.MarkDisabled();
|
||||
|
||||
HistorianPluginLoader.LastOutcome.Status.ShouldBe(HistorianPluginStatus.Disabled);
|
||||
HistorianPluginLoader.LastOutcome.Error.ShouldBeNull();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When the plugin directory is missing, TryLoad reports NotFound — not LoadFailed —
|
||||
/// and returns null so the server can start with history disabled.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void TryLoad_PluginMissing_ReturnsNullWithNotFoundOutcome()
|
||||
{
|
||||
// The test process runs from a bin directory that does not contain a Historian/
|
||||
// subfolder, so TryLoad will take the file-missing branch.
|
||||
var config = new HistorianConfiguration { Enabled = true };
|
||||
|
||||
var result = HistorianPluginLoader.TryLoad(config);
|
||||
|
||||
result.ShouldBeNull();
|
||||
HistorianPluginLoader.LastOutcome.Status.ShouldBe(HistorianPluginStatus.NotFound);
|
||||
HistorianPluginLoader.LastOutcome.PluginPath.ShouldContain("ZB.MOM.WW.LmxOpcUa.Historian.Aveva.dll");
|
||||
HistorianPluginLoader.LastOutcome.Error.ShouldBeNull();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user