7b0b9c7365
Solution + 23 src projects + 26 test projects renamed; folders, csproj, namespaces, and ScadaLinkDbContext/ScadaBridgeDbContext class updated. ActorSystem "scadalink" → "scadabridge", Akka seed-node URLs migrated. SQL roles/logins, LDAP domains, CLI command name, and CLI config dir (~/.scadalink → ~/.scadabridge) also renamed. Build green; 5 Host.Tests fail awaiting SQL login rename in next commit. Pre-existing StaleTagMonitor timing flakes unchanged. Rename script committed at tools/rename-to-scadabridge.sh.
58 lines
2.1 KiB
C#
58 lines
2.1 KiB
C#
namespace ZB.MOM.WW.ScadaBridge.HealthMonitoring.Tests;
|
|
|
|
/// <summary>
|
|
/// Bundle C (M5-T7) regression coverage. The Audit Log payload filter
|
|
/// (<c>DefaultAuditPayloadFilter</c>) increments
|
|
/// <c>IAuditRedactionFailureCounter</c> every time a header/body/SQL-param
|
|
/// redactor stage throws and the filter has to over-redact the field with
|
|
/// the <c><redacted: redactor error></c> marker. Bundle C bridges that
|
|
/// counter into the Site Health Monitoring report payload as
|
|
/// <c>AuditRedactionFailure</c> so a misconfigured / catastrophic regex
|
|
/// surfaces on /monitoring/health rather than disappearing into a NoOp sink.
|
|
/// Mirrors the Bundle G <c>SiteAuditWriteFailures</c> metric shape — same
|
|
/// per-interval increment-and-reset semantics, same defaults-to-zero
|
|
/// contract.
|
|
/// </summary>
|
|
public class AuditRedactionFailureMetricTests
|
|
{
|
|
private readonly SiteHealthCollector _collector = new();
|
|
|
|
[Fact]
|
|
public void Increment_Three_Times_Counter_Reports_3()
|
|
{
|
|
_collector.IncrementAuditRedactionFailure();
|
|
_collector.IncrementAuditRedactionFailure();
|
|
_collector.IncrementAuditRedactionFailure();
|
|
|
|
var report = _collector.CollectReport("site-1");
|
|
|
|
Assert.Equal(3, report.AuditRedactionFailure);
|
|
}
|
|
|
|
[Fact]
|
|
public void Report_Payload_Includes_AuditRedactionFailure_AsZeroByDefault()
|
|
{
|
|
var report = _collector.CollectReport("site-1");
|
|
|
|
Assert.Equal(0, report.AuditRedactionFailure);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Mirrors the existing per-interval reset semantics for ScriptErrorCount /
|
|
/// AlarmEvaluationErrorCount / DeadLetterCount / SiteAuditWriteFailures —
|
|
/// AuditRedactionFailure is an interval count, not a running total.
|
|
/// </summary>
|
|
[Fact]
|
|
public void CollectReport_Resets_AuditRedactionFailure()
|
|
{
|
|
_collector.IncrementAuditRedactionFailure();
|
|
_collector.IncrementAuditRedactionFailure();
|
|
|
|
var first = _collector.CollectReport("site-1");
|
|
Assert.Equal(2, first.AuditRedactionFailure);
|
|
|
|
var second = _collector.CollectReport("site-1");
|
|
Assert.Equal(0, second.AuditRedactionFailure);
|
|
}
|
|
}
|