refactor(adminui): explicit discard on fire-and-forget audit + Untrust not-found test (review)
v2-ci / build (push) Failing after 49s
v2-ci / unit-tests (tests/Core/ZB.MOM.WW.OtOpcUa.Cluster.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.ControlPlane.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Security.Tests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.Host.IntegrationTests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests) (push) Has been skipped

This commit is contained in:
Joseph Doherty
2026-06-19 00:45:10 -04:00
parent 3ee0099fae
commit 3eb370d4ea
2 changed files with 16 additions and 1 deletions
@@ -102,7 +102,7 @@ public sealed class CertificateStoreManager
// store mutation stays synchronous. Every return path (success + every failure) is audited // store mutation stays synchronous. Every return path (success + every failure) is audited
// because Trust/Untrust/Delete each route their single result through here. // because Trust/Untrust/Delete each route their single result through here.
private void Audit(string action, string store, string thumbprint, string actor, CertActionResult r) private void Audit(string action, string store, string thumbprint, string actor, CertActionResult r)
=> _audit.WriteAsync(CertAuditEvents.Build(action, store, thumbprint, actor, r.Success, r.Error)); => _ = _audit.WriteAsync(CertAuditEvents.Build(action, store, thumbprint, actor, r.Success, r.Error));
private CertActionResult Move(string fromSub, string toSub, string thumbprint) private CertActionResult Move(string fromSub, string toSub, string thumbprint)
{ {
@@ -288,4 +288,19 @@ public sealed class CertificateStoreManagerTests : IDisposable
evt.SourceNode.ShouldBe(absent); evt.SourceNode.ShouldBe(absent);
evt.Actor.ShouldBe("bob"); evt.Actor.ShouldBe("bob");
} }
[Fact]
public void Untrust_not_found_writes_one_failure_audit_event()
{
var absent = new string('0', 40);
var result = _sut.Untrust(absent, "erin");
result.Success.ShouldBeFalse();
var evt = _audit.Events.ShouldHaveSingleItem();
evt.Action.ShouldBe("Untrust");
evt.Outcome.ShouldBe(ZB.MOM.WW.Audit.AuditOutcome.Failure);
evt.SourceNode.ShouldBe(absent);
evt.Actor.ShouldBe("erin");
}
} }