test(site-runtime): fix stale SetStaticAttribute tests
HandleSetStaticAttribute was made fire-and-forget (commit 2951507) — it no
longer replies with SetStaticAttributeResponse — but three InstanceActor
tests still ExpectMsg<SetStaticAttributeResponse> and timed out. Verify the
mutation via the GetAttributeRequest round-trip instead, which the FIFO
mailbox makes a sound sync point. Test intent (in-memory update, SQLite
persistence, serialized ordering) is unchanged.
This commit is contained in:
@@ -113,13 +113,12 @@ public class InstanceActorTests : TestKit, IDisposable
|
||||
|
||||
var actor = CreateInstanceActor("Pump1", config);
|
||||
|
||||
// Set a static attribute -- response comes async via PipeTo
|
||||
// SetStaticAttributeCommand is fire-and-forget (no reply); the
|
||||
// GetAttributeRequest round-trip below confirms it was applied — the
|
||||
// actor mailbox is FIFO, so the set is processed before the get.
|
||||
actor.Tell(new SetStaticAttributeCommand(
|
||||
"corr-3", "Pump1", "Temperature", "100.0", DateTimeOffset.UtcNow));
|
||||
|
||||
var setResponse = ExpectMsg<SetStaticAttributeResponse>(TimeSpan.FromSeconds(5));
|
||||
Assert.True(setResponse.Success);
|
||||
|
||||
// Verify the value changed in memory
|
||||
actor.Tell(new GetAttributeRequest(
|
||||
"corr-4", "Pump1", "Temperature", DateTimeOffset.UtcNow));
|
||||
@@ -146,9 +145,12 @@ public class InstanceActorTests : TestKit, IDisposable
|
||||
actor.Tell(new SetStaticAttributeCommand(
|
||||
"corr-persist", "PumpPersist1", "Temperature", "100.0", DateTimeOffset.UtcNow));
|
||||
|
||||
ExpectMsg<SetStaticAttributeResponse>(TimeSpan.FromSeconds(5));
|
||||
|
||||
// Give async persistence time to complete
|
||||
// SetStaticAttributeCommand is fire-and-forget; round-trip a
|
||||
// GetAttributeRequest to confirm the command was processed (FIFO
|
||||
// mailbox), then wait for the async SQLite persist to complete.
|
||||
actor.Tell(new GetAttributeRequest(
|
||||
"corr-persist-get", "PumpPersist1", "Temperature", DateTimeOffset.UtcNow));
|
||||
ExpectMsg<GetAttributeResponse>(TimeSpan.FromSeconds(5));
|
||||
await Task.Delay(500);
|
||||
|
||||
// Verify it persisted to SQLite
|
||||
|
||||
Reference in New Issue
Block a user