Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions tests/Proto.Actor.Tests/SupervisionTests_AlwaysRestart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ public async Task AlwaysRestartStrategy_Should_RestartFailingChildOnly()
var child2Started = 0;
var strategy = new AlwaysRestartStrategy();

var child1Props = Props.FromProducer(() => new ChildActor(() => child1Started++));
// attach a probe to the failing child to observe its mailbox
var (probe, probePid) = system.CreateTestProbe();
context.Send(probePid, "start");
await probe.FishForMessageAsync<string>();

var child1Props = Props.FromProducer(() => new ChildActor(() => child1Started++))
.WithMailboxProbe(probe);
var child2Props = Props.FromProducer(() => new ChildActor(() => child2Started++));

var parentProps = Props.FromProducer(() => new ParentActor(child1Props, child2Props))
Expand All @@ -30,7 +36,8 @@ public async Task AlwaysRestartStrategy_Should_RestartFailingChildOnly()

context.Send(parent, "fail");

await Task.Delay(1000);
// Wait for the restart system message instead of relying on elapsed time
await probe.FishForMessageAsync<Restart>();

Assert.Equal(2, child1Started);
Assert.Equal(1, child2Started);
Expand Down
Loading