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.
This commit is contained in:
@@ -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)
|
private static WorkerEnvelope CreateCommandEnvelope(string correlationId, ulong sequence = 2)
|
||||||
{
|
{
|
||||||
return new WorkerEnvelope
|
return new WorkerEnvelope
|
||||||
@@ -1142,10 +1147,10 @@ public sealed class WorkerPipeSessionTests
|
|||||||
{
|
{
|
||||||
Command = new MxCommand
|
Command = new MxCommand
|
||||||
{
|
{
|
||||||
Kind = MxCommandKind.Ping,
|
Kind = MxCommandKind.Register,
|
||||||
Ping = new PingCommand
|
Register = new RegisterCommand
|
||||||
{
|
{
|
||||||
Message = "ping",
|
ClientName = "test-client",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
EnqueueTimestamp = Timestamp.FromDateTimeOffset(DateTimeOffset.UtcNow),
|
EnqueueTimestamp = Timestamp.FromDateTimeOffset(DateTimeOffset.UtcNow),
|
||||||
|
|||||||
Reference in New Issue
Block a user