From dc999fd2a80fe2955053ec5f7acbc464267cbd04 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Tue, 26 Apr 2022 00:50:11 +0700 Subject: [PATCH] Convert Akka.Remote.Tests to async - TransientSerializationErrorSpec --- .../TransientSerializationErrorSpec.cs | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/core/Akka.Remote.Tests/TransientSerializationErrorSpec.cs b/src/core/Akka.Remote.Tests/TransientSerializationErrorSpec.cs index b151f8e3b45..ebd00eb7a43 100644 --- a/src/core/Akka.Remote.Tests/TransientSerializationErrorSpec.cs +++ b/src/core/Akka.Remote.Tests/TransientSerializationErrorSpec.cs @@ -116,7 +116,7 @@ public override byte[] ToBinary(object obj) } } - internal class EchoActor : ActorBase + private class EchoActor : ActorBase { public static Props Props() { @@ -130,16 +130,16 @@ protected override bool Receive(object message) } } - private readonly ActorSystem system2; - private readonly Address system2Address; + private readonly ActorSystem _system2; + private readonly Address _system2Address; - public AbstractTransientSerializationErrorSpec(Config config) + protected AbstractTransientSerializationErrorSpec(Config config) : base(config.WithFallback(ConfigurationFactory.ParseString(GetConfig()))) { var port = ((ExtendedActorSystem)Sys).Provider.DefaultAddress.Port; - system2 = ActorSystem.Create(Sys.Name, Sys.Settings.Config); - system2Address = ((ExtendedActorSystem)system2).Provider.DefaultAddress; + _system2 = ActorSystem.Create(Sys.Name, Sys.Settings.Config); + _system2Address = ((ExtendedActorSystem)_system2).Provider.DefaultAddress; } private static string GetConfig() @@ -168,21 +168,22 @@ private static string GetConfig() "; } - protected override async Task AfterTerminationAsync() + protected override async Task AfterAllAsync() { - await ShutdownAsync(system2); + await base.AfterAllAsync(); + await ShutdownAsync(_system2); } [Fact] - public void The_transport_must_stay_alive_after_a_transient_exception_from_the_serializer() + public async Task The_transport_must_stay_alive_after_a_transient_exception_from_the_serializer() { - system2.ActorOf(EchoActor.Props(), "echo"); + _system2.ActorOf(EchoActor.Props(), "echo"); - var selection = Sys.ActorSelection(new RootActorPath(system2Address) / "user" / "echo"); + var selection = Sys.ActorSelection(new RootActorPath(_system2Address) / "user" / "echo"); selection.Tell("ping", this.TestActor); - ExpectMsg("ping"); + await ExpectMsgAsync("ping"); // none of these should tear down the connection selection.Tell(ManifestIllegal.Instance, this.TestActor); @@ -194,7 +195,7 @@ public void The_transport_must_stay_alive_after_a_transient_exception_from_the_s // make sure we still have a connection selection.Tell("ping", this.TestActor); - ExpectMsg("ping"); + await ExpectMsgAsync("ping"); } }