fix(communication): ReconcileSite threads the gRPC call's cancellation into central reconcile work (review 2026-10-21 03/P-1b)

This commit is contained in:
Joseph Doherty
2026-10-22 08:32:07 -04:00
parent 429ccb8d90
commit dd60e236bd
5 changed files with 94 additions and 5 deletions
@@ -139,6 +139,29 @@ public class CentralControlGrpcServiceTests : TestKit
Assert.Empty(ack.AcceptedEventIds);
}
/// <summary>Verifies that ReconcileSite hands the actor the gRPC call's cancellation token (review 2026-10-21 03/P-1b).</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task ReconcileSite_CarriesTheCallCancellationToken_ToTheActor()
{
var probe = CreateTestProbe();
var service = CreateService();
service.SetReady(probe.Ref);
using var callCts = new CancellationTokenSource();
var reply = service.ReconcileSite(
new ReconcileSiteRequestDto { SiteIdentifier = "site1", NodeId = "node-a" }, NewContext(callCts.Token));
var call = probe.ExpectMsg<ZB.MOM.WW.ScadaBridge.Communication.Actors.ReconcileSiteCall>(TimeSpan.FromSeconds(3));
Assert.Equal("site1", call.Request.SiteIdentifier);
Assert.Equal(callCts.Token, call.CallCancelled);
probe.Reply(new ZB.MOM.WW.ScadaBridge.Commons.Messages.Deployment.ReconcileSiteResponse(
new List<ZB.MOM.WW.ScadaBridge.Commons.Messages.Deployment.ReconcileGapItem>(),
new List<string>(), "http://central"));
await reply;
}
/// <summary>Verifies that the audit ingest timeout is the single shared constant.</summary>
[Fact]
public void TheAuditIngestTimeout_IsTheOneSharedConstant()