test(runtime): await rebuild outcomes before asserting no-op
v2-ci / unit-tests (push) Waiting to run
v2-ci / unit-tests (push) Waiting to run
This commit is contained in:
+15
-4
@@ -131,13 +131,24 @@ public sealed class OpcUaPublishActorRebuildTests : RuntimeActorTestBase
|
|||||||
var actor = Sys.ActorOf(OpcUaPublishActor.PropsForTests(
|
var actor = Sys.ActorOf(OpcUaPublishActor.PropsForTests(
|
||||||
sink: sink, dbFactory: db, applier: applier));
|
sink: sink, dbFactory: db, applier: applier));
|
||||||
|
|
||||||
actor.Tell(Rebuild(dep));
|
// EF is recorded before the first apply's NodeAdded announcement. Wait for each reply so
|
||||||
AwaitAssert(() => sink.Calls.ShouldContain("EF:eq-1"), duration: PresenceBudget, cancellationToken: TestContext.Current.CancellationToken);
|
// the snapshot includes every first-apply call and the second apply has actually finished.
|
||||||
|
var first = Rebuild(dep) with { ReportOutcome = true };
|
||||||
|
actor.Tell(first);
|
||||||
|
var firstCompleted = ExpectMsg<OpcUaPublishActor.RebuildCompleted>(PresenceBudget,
|
||||||
|
cancellationToken: TestContext.Current.CancellationToken);
|
||||||
|
firstCompleted.Correlation.ShouldBe(first.Correlation);
|
||||||
|
firstCompleted.Degraded.ShouldBeFalse();
|
||||||
|
sink.Calls.ShouldContain("EF:eq-1");
|
||||||
sink.RebuildCalls.ShouldBe(0); // PureAdd — no full rebuild
|
sink.RebuildCalls.ShouldBe(0); // PureAdd — no full rebuild
|
||||||
var callsAfterFirst = sink.Calls.Count;
|
var callsAfterFirst = sink.Calls.Count;
|
||||||
|
|
||||||
actor.Tell(Rebuild(dep));
|
var second = Rebuild(dep) with { ReportOutcome = true };
|
||||||
Thread.Sleep(200);
|
actor.Tell(second);
|
||||||
|
var secondCompleted = ExpectMsg<OpcUaPublishActor.RebuildCompleted>(PresenceBudget,
|
||||||
|
cancellationToken: TestContext.Current.CancellationToken);
|
||||||
|
secondCompleted.Correlation.ShouldBe(second.Correlation);
|
||||||
|
secondCompleted.Degraded.ShouldBeFalse();
|
||||||
// Same composition ⇒ plan IsEmpty ⇒ applier + materialise passes not run again.
|
// Same composition ⇒ plan IsEmpty ⇒ applier + materialise passes not run again.
|
||||||
sink.Calls.Count.ShouldBe(callsAfterFirst);
|
sink.Calls.Count.ShouldBe(callsAfterFirst);
|
||||||
sink.RebuildCalls.ShouldBe(0);
|
sink.RebuildCalls.ShouldBe(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user