Skip to content

Commit

Permalink
Port Akka.Tests.Routing tests to async/await - `ScatterGatherFirs…
Browse files Browse the repository at this point in the history
…tCompletedSpec` (#5814)
  • Loading branch information
eaba authored Apr 5, 2022
1 parent 72e53b6 commit 90447a8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/core/Akka.Tests/Routing/ScatterGatherFirstCompletedSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ public StopActor(int id, TestLatch shutdownLatch)
{
});

ReceiveAny(x =>
ReceiveAnyAsync(async x =>
{
Thread.Sleep(100 * _id);
await Task.Delay(100 * _id);
Sender.Tell(_id);
});
}
Expand Down Expand Up @@ -122,19 +122,19 @@ public async Task Scatter_gather_group_must_return_response_even_if_one_of_the_a
}

[Fact]
public void Scatter_gather_pool_must_without_routees_should_reply_immediately()
public async Task Scatter_gather_pool_must_without_routees_should_reply_immediately()
{
var probe = CreateTestProbe();
var routedActor = Sys.ActorOf(new ScatterGatherFirstCompletedPool(0, TimeSpan.FromSeconds(5)).Props(Props.Empty));
routedActor.Tell("hello", probe.Ref);
var message = probe.ExpectMsg<Status.Failure>(2.Seconds());
var message = await probe.ExpectMsgAsync<Status.Failure>(2.Seconds());
message.Should().NotBeNull();
message.Cause.Should().BeOfType<AskTimeoutException>();
}

// Resolved https://github.com/akkadotnet/akka.net/issues/1718
[Fact]
public void Scatter_gather_group_must_only_return_one_response()
public async Task Scatter_gather_group_must_only_return_one_response()
{
var actor1 = Sys.ActorOf(Props.Create(() => new StopActor(1, null)));
var actor2 = Sys.ActorOf(Props.Create(() => new StopActor(14, null)));
Expand All @@ -144,8 +144,8 @@ public void Scatter_gather_group_must_only_return_one_response()

routedActor.Tell(0);

ExpectMsg<int>();
ExpectNoMsg();
await ExpectMsgAsync<int>();
await ExpectNoMsgAsync();
}

// Resolved https://github.com/akkadotnet/akka.net/issues/1718
Expand Down

0 comments on commit 90447a8

Please sign in to comment.