feat(sitecall-audit): add SourceNode to SiteCallOperational + SiteCall entity
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using ScadaLink.Commons.Types;
|
||||
|
||||
namespace ScadaLink.Commons.Tests.Types;
|
||||
|
||||
/// <summary>
|
||||
/// Verifies <see cref="SiteCallOperational"/> — the positional record carried on
|
||||
/// the combined <c>CachedCallTelemetry</c> packet — round-trips the SourceNode
|
||||
/// field through positional construction (where the parameter sits between
|
||||
/// <c>SourceSite</c> and <c>Status</c>, mirroring the central <c>SiteCalls</c>
|
||||
/// table column order).
|
||||
/// </summary>
|
||||
public class SiteCallOperationalTests
|
||||
{
|
||||
[Fact]
|
||||
public void SiteCallOperational_carries_SourceNode()
|
||||
{
|
||||
// SourceNode identifies the cluster node that emitted the cached call
|
||||
// (site node-a/node-b or central-a/central-b). Nullable — callsites
|
||||
// pass null until INodeIdentityProvider stamping arrives in Task 14.
|
||||
var trackedId = TrackedOperationId.New();
|
||||
var nowUtc = new DateTime(2026, 5, 23, 12, 0, 0, DateTimeKind.Utc);
|
||||
|
||||
var defaulted = new SiteCallOperational(
|
||||
TrackedOperationId: trackedId,
|
||||
Channel: "ApiOutbound",
|
||||
Target: "ERP.GetOrder",
|
||||
SourceSite: "site-01",
|
||||
SourceNode: null,
|
||||
Status: "Submitted",
|
||||
RetryCount: 0,
|
||||
LastError: null,
|
||||
HttpStatus: null,
|
||||
CreatedAtUtc: nowUtc,
|
||||
UpdatedAtUtc: nowUtc,
|
||||
TerminalAtUtc: null);
|
||||
Assert.Null(defaulted.SourceNode);
|
||||
|
||||
var stamped = defaulted with { SourceNode = "node-a" };
|
||||
Assert.Equal("node-a", stamped.SourceNode);
|
||||
Assert.Null(defaulted.SourceNode);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user