Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port Akka.Tests.Routing tests to async/await - ScatterGatherFirstCompletedSpec #5814

Merged
merged 2 commits into from
Apr 5, 2022
Merged
Changes from 1 commit
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
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