From f94c20648924888e0c3a5d2866e333aa14ebdeab Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Mon, 15 Jun 2026 10:25:34 -0400 Subject: [PATCH] test(worker): use Register (a real STA command) for STA-dispatch race tests Ping is now intercepted as a worker control command and answered on the message-loop thread, so the dispatch/heartbeat/shutdown-race tests must use a genuine STA-dispatched command kind to keep exercising DispatchAsync. --- .../Ipc/WorkerPipeSessionTests.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ZB.MOM.WW.MxGateway.Worker.Tests/Ipc/WorkerPipeSessionTests.cs b/src/ZB.MOM.WW.MxGateway.Worker.Tests/Ipc/WorkerPipeSessionTests.cs index ceb5696..1db3fd0 100644 --- a/src/ZB.MOM.WW.MxGateway.Worker.Tests/Ipc/WorkerPipeSessionTests.cs +++ b/src/ZB.MOM.WW.MxGateway.Worker.Tests/Ipc/WorkerPipeSessionTests.cs @@ -1130,6 +1130,11 @@ public sealed class WorkerPipeSessionTests }; } + // A generic STA-dispatched command used by the dispatch/heartbeat/ + // shutdown-race tests. Register is a real MXAccess command kind (not a + // worker control command), so it flows through IWorkerRuntimeSession + // .DispatchAsync — unlike Ping/GetSessionState/etc., which are answered on + // the message-loop thread without touching the STA. private static WorkerEnvelope CreateCommandEnvelope(string correlationId, ulong sequence = 2) { return new WorkerEnvelope @@ -1142,10 +1147,10 @@ public sealed class WorkerPipeSessionTests { Command = new MxCommand { - Kind = MxCommandKind.Ping, - Ping = new PingCommand + Kind = MxCommandKind.Register, + Register = new RegisterCommand { - Message = "ping", + ClientName = "test-client", }, }, EnqueueTimestamp = Timestamp.FromDateTimeOffset(DateTimeOffset.UtcNow),