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

Fix AkkaProtocolStressTest spec #5020

Merged
merged 2 commits into from
May 18, 2021
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
15 changes: 11 additions & 4 deletions src/core/Akka.Remote.Tests/Transport/AkkaProtocolStressTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Akka.TestKit.TestEvent;
using Akka.Util.Internal;
using Xunit;
using Xunit.Abstractions;

namespace Akka.Remote.Tests.Transport
{
Expand Down Expand Up @@ -163,22 +164,23 @@ private IActorRef Here
get
{
Sys.ActorSelection(RootB / "user" / "echo").Tell(new Identify(null), TestActor);
return ExpectMsg<ActorIdentity>(TimeSpan.FromSeconds(300)).Subject;
var subject = ExpectMsg<ActorIdentity>(TimeSpan.FromSeconds(3)).Subject;
return subject;
}
}


#endregion

public AkkaProtocolStressTest() : base(AkkaProtocolStressTestConfig)
public AkkaProtocolStressTest(ITestOutputHelper output) : base(AkkaProtocolStressTestConfig, output)
{
systemB = ActorSystem.Create("systemB", Sys.Settings.Config);
remote = systemB.ActorOf(Props.Create<Echo>(), "echo");
}

#region Tests

[Fact(Skip = "Extremely racy")]
[Fact]
public void AkkaProtocolTransport_must_guarantee_at_most_once_delivery_and_message_ordering_despite_packet_loss()
{
//todo mute both systems for deadletters for any type of message
Expand All @@ -190,7 +192,12 @@ public void AkkaProtocolTransport_must_guarantee_at_most_once_delivery_and_messa
new FailureInjectorTransportAdapter.Drop(0.1, 0.1)));
AwaitCondition(() => mc.IsCompleted && mc.Result, TimeSpan.FromSeconds(3));

var here = Here;
IActorRef here = null;
AwaitCondition(() =>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here property uses ActorSelection that can return a null Subject that causes NRE down the line (caused by EmptyLocalActorRef). Using AwaitCondition here to force the spec to wait until Here returns a valid IActorRef

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - how many times did you run this one successively without failures?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1000 times minimum

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works for me

{
here = Here;
return here != null && !here.Equals(ActorRefs.Nobody);
}, TimeSpan.FromSeconds(3));

var tester = Sys.ActorOf(Props.Create(() => new SequenceVerifier(here, TestActor)));
tester.Tell("start");
Expand Down