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

[Async TestKit] Convert Akka.Remote.Tests to async - RemoteMetricsSpec #5888

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
23 changes: 11 additions & 12 deletions src/core/Akka.Remote.Tests/RemoteMetricsSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,40 +58,40 @@ protected override async Task AfterTerminationAsync()


[Fact]
public void RemoteMetricsMustNotLogMessagesLargerThanFrameSizeExceeding()
public async Task RemoteMetricsMustNotLogMessagesLargerThanFrameSizeExceeding()
{
var sel = _client.ActorSelection(new RootActorPath(_address)/_subject.Path.Elements);
sel.Tell(new byte[200]);
ExpectMsg<PayloadSize>();
await ExpectMsgAsync<PayloadSize>();
}

[Fact]
public void RemoteMetricsMustLogNewMessageSizeForTheSameMessageTypeLargerThanThePreviousOneOnTheThreshold()
public async Task RemoteMetricsMustLogNewMessageSizeForTheSameMessageTypeLargerThanThePreviousOneOnTheThreshold()
{
var sel = _client.ActorSelection(new RootActorPath(_address)/_subject.Path.Elements);
sel.Tell(new byte[200]);
ExpectMsg<PayloadSize>();
await ExpectMsgAsync<PayloadSize>();
sel.Tell(new byte[300]);
ExpectMsg<NewMaximum>();
await ExpectMsgAsync<NewMaximum>();
}


[Fact]
public void RemoteMetricsMustNotLogMessagesLessThanFrameSizeExceeding()
public async Task RemoteMetricsMustNotLogMessagesLessThanFrameSizeExceeding()
{
var sel = _client.ActorSelection(new RootActorPath(_address)/_subject.Path.Elements);
sel.Tell(new byte[1]);
ExpectNoMsg();
await ExpectNoMsgAsync();
}

[Fact]
public void RemoteMetricsMustNotLogTheSameMessageSizeTwice()
public async Task RemoteMetricsMustNotLogTheSameMessageSizeTwice()
{
var sel = _client.ActorSelection(new RootActorPath(_address)/_subject.Path.Elements);
sel.Tell(new byte[200]);
ExpectMsg<PayloadSize>();
await ExpectMsgAsync<PayloadSize>();
sel.Tell(new byte[200]);
ExpectNoMsg();
await ExpectNoMsgAsync();
}

private class Subject : ActorBase
Expand All @@ -114,9 +114,8 @@ public InfoEventListener(IActorRef testActor)

protected override bool Receive(object message)
{
if (message is Info)
if (message is Info info)
{
var info = ((Info) message);
if (info.Message.ToString().Contains("New maximum payload size for"))
{
_testActor.Tell(new NewMaximum());
Expand Down