From 138e765d8073a041f7af5afc81e1a0b1bdcd4deb Mon Sep 17 00:00:00 2001 From: Aaron Stannard Date: Thu, 23 May 2024 13:06:07 -0500 Subject: [PATCH 1/5] disable auto-downing on restart specs --- .../Singleton/ClusterSingletonRestart2Spec.cs | 2 +- .../Singleton/ClusterSingletonRestart3Spec.cs | 2 +- .../Singleton/ClusterSingletonRestartSpec.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart2Spec.cs b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart2Spec.cs index 3499bd0f158..4ab2a8cd34b 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart2Spec.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart2Spec.cs @@ -29,7 +29,7 @@ public ClusterSingletonRestart2Spec() : base(@" akka.loglevel = INFO akka.actor.provider = ""cluster"" akka.cluster.roles = [singleton] - akka.cluster.auto-down-unreachable-after = 2s + #akka.cluster.auto-down-unreachable-after = 2s akka.cluster.singleton.min-number-of-hand-over-retries = 5 akka.remote { dot-netty.tcp { diff --git a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart3Spec.cs b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart3Spec.cs index 04f3d2011ff..0adbdaf5a02 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart3Spec.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart3Spec.cs @@ -29,7 +29,7 @@ public ClusterSingletonRestart3Spec(ITestOutputHelper output) : base(@" akka.loglevel = DEBUG akka.actor.provider = ""cluster"" akka.cluster.app-version = ""1.0.0"" - akka.cluster.auto-down-unreachable-after = 2s + #akka.cluster.auto-down-unreachable-after = 2s akka.cluster.singleton.min-number-of-hand-over-retries = 5 akka.cluster.singleton.consider-app-version = true akka.remote { diff --git a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestartSpec.cs b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestartSpec.cs index e2f5c5123d6..76c6ac98717 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestartSpec.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestartSpec.cs @@ -28,7 +28,7 @@ public class ClusterSingletonRestartSpec : AkkaSpec public ClusterSingletonRestartSpec() : base(@" akka.loglevel = INFO akka.actor.provider = ""cluster"" - akka.cluster.auto-down-unreachable-after = 2s + #akka.cluster.auto-down-unreachable-after = 2s akka.remote { dot-netty.tcp { hostname = ""127.0.0.1"" From 2f0b023d0a8f8d29b311b96de147bf2d4483844a Mon Sep 17 00:00:00 2001 From: Aaron Stannard Date: Fri, 31 May 2024 07:45:45 -0500 Subject: [PATCH 2/5] added output helper --- .../Singleton/ClusterSingletonRestart2Spec.cs | 27 ++++++++++--------- .../Singleton/ClusterSingletonRestartSpec.cs | 5 ++-- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart2Spec.cs b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart2Spec.cs index 4ab2a8cd34b..b853750cc65 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart2Spec.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart2Spec.cs @@ -15,6 +15,7 @@ using Akka.TestKit; using FluentAssertions; using Xunit; +using Xunit.Abstractions; namespace Akka.Cluster.Tools.Tests.Singleton { @@ -25,18 +26,20 @@ public class ClusterSingletonRestart2Spec : AkkaSpec private readonly ActorSystem _sys3; private ActorSystem _sys4 = null; - public ClusterSingletonRestart2Spec() : base(@" - akka.loglevel = INFO - akka.actor.provider = ""cluster"" - akka.cluster.roles = [singleton] - #akka.cluster.auto-down-unreachable-after = 2s - akka.cluster.singleton.min-number-of-hand-over-retries = 5 - akka.remote { - dot-netty.tcp { - hostname = ""127.0.0.1"" - port = 0 - } - }") + public ClusterSingletonRestart2Spec(ITestOutputHelper output) : base(""" + + akka.loglevel = INFO + akka.actor.provider = "cluster" + akka.cluster.roles = [singleton] + #akka.cluster.auto-down-unreachable-after = 2s + akka.cluster.singleton.min-number-of-hand-over-retries = 5 + akka.remote { + dot-netty.tcp { + hostname = "127.0.0.1" + port = 0 + } + } + """, output) { _sys1 = ActorSystem.Create(Sys.Name, Sys.Settings.Config); _sys2 = ActorSystem.Create(Sys.Name, Sys.Settings.Config); diff --git a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestartSpec.cs b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestartSpec.cs index 76c6ac98717..060023f918a 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestartSpec.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestartSpec.cs @@ -16,6 +16,7 @@ using Akka.TestKit.TestActors; using FluentAssertions; using Xunit; +using Xunit.Abstractions; namespace Akka.Cluster.Tools.Tests.Singleton { @@ -25,7 +26,7 @@ public class ClusterSingletonRestartSpec : AkkaSpec private readonly ActorSystem _sys2; private ActorSystem _sys3 = null; - public ClusterSingletonRestartSpec() : base(@" + public ClusterSingletonRestartSpec(ITestOutputHelper output) : base(@" akka.loglevel = INFO akka.actor.provider = ""cluster"" #akka.cluster.auto-down-unreachable-after = 2s @@ -34,7 +35,7 @@ public ClusterSingletonRestartSpec() : base(@" hostname = ""127.0.0.1"" port = 0 } - }") + }", output) { _sys1 = ActorSystem.Create(Sys.Name, Sys.Settings.Config); _sys2 = ActorSystem.Create(Sys.Name, Sys.Settings.Config); From 15afdabc8a3c03467ecbe4f96471c07af7e44ca6 Mon Sep 17 00:00:00 2001 From: Aaron Stannard Date: Fri, 31 May 2024 07:58:56 -0500 Subject: [PATCH 3/5] migrated `ClusterSingletonRestart2Spec` to `async` TestKit methods --- .../Singleton/ClusterSingletonRestart2Spec.cs | 44 ++++++++++++------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart2Spec.cs b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart2Spec.cs index b853750cc65..a4b37052608 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart2Spec.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart2Spec.cs @@ -45,9 +45,14 @@ public ClusterSingletonRestart2Spec(ITestOutputHelper output) : base(""" _sys2 = ActorSystem.Create(Sys.Name, Sys.Settings.Config); _sys3 = ActorSystem.Create(Sys.Name, ConfigurationFactory.ParseString("akka.cluster.roles = [other]") .WithFallback(Sys.Settings.Config)); + + // ensure xunit output is captured + InitializeLogger(_sys1); + InitializeLogger(_sys2); + InitializeLogger(_sys3); } - public void Join(ActorSystem from, ActorSystem to) + public Task Join(ActorSystem from, ActorSystem to) { if (Cluster.Get(from).SelfRoles.Contains("singleton")) { @@ -57,9 +62,9 @@ public void Join(ActorSystem from, ActorSystem to) } - Within(TimeSpan.FromSeconds(45), () => + return WithinAsync(TimeSpan.FromSeconds(45), () => { - AwaitAssert(() => + return AwaitAssertAsync(() => { Cluster.Get(from).Join(Cluster.Get(to).SelfAddress); Cluster.Get(from).State.Members.Select(x => x.UniqueAddress).Should().Contain(Cluster.Get(from).SelfUniqueAddress); @@ -73,23 +78,27 @@ public void Join(ActorSystem from, ActorSystem to) } [Fact] - public void Restarting_cluster_node_during_hand_over_must_restart_singletons_in_restarted_node() + public async Task Restarting_cluster_node_during_hand_over_must_restart_singletons_in_restarted_node() { - Join(_sys1, _sys1); - Join(_sys2, _sys1); - Join(_sys3, _sys1); + var joinTasks = new[] + { + Join(_sys1, _sys1), + Join(_sys2, _sys1), + Join(_sys3, _sys1) + }; + await Task.WhenAll(joinTasks); var proxy3 = _sys3.ActorOf( ClusterSingletonProxy.Props("user/echo", ClusterSingletonProxySettings.Create(_sys3).WithRole("singleton")), "proxy3"); - Within(TimeSpan.FromSeconds(5), () => + await WithinAsync(TimeSpan.FromSeconds(5), () => { - AwaitAssert(() => + return AwaitAssertAsync(async () => { var probe = CreateTestProbe(_sys3); proxy3.Tell("hello", probe.Ref); - probe.ExpectMsg(TimeSpan.FromSeconds(1)) - .Should() + var msg = await probe.ExpectMsgAsync(TimeSpan.FromSeconds(1)); + msg.Should() .Be(Cluster.Get(_sys1).SelfUniqueAddress); }); }); @@ -106,23 +115,24 @@ public void Restarting_cluster_node_during_hand_over_must_restart_singletons_in_ var sys4Config = ConfigurationFactory.ParseString(@"akka.remote.dot-netty.tcp.port=" + sys2Port) .WithFallback(_sys1.Settings.Config); _sys4 = ActorSystem.Create(_sys1.Name, sys4Config); + InitializeLogger(_sys4); // ensure xunit output is captured - Join(_sys4, _sys3); + await Join(_sys4, _sys3); // let it stabilize - Task.Delay(TimeSpan.FromSeconds(5)).Wait(); + //Task.Delay(TimeSpan.FromSeconds(5)).Wait(); - Within(TimeSpan.FromSeconds(10), () => + await WithinAsync(TimeSpan.FromSeconds(10), () => { - AwaitAssert(() => + return AwaitAssertAsync(async () => { var probe = CreateTestProbe(_sys3); proxy3.Tell("hello2", probe.Ref); // note that sys3 doesn't have the required singleton role, so singleton instance should be // on the restarted node - probe.ExpectMsg(TimeSpan.FromSeconds(1)) - .Should() + var msg = await probe.ExpectMsgAsync(TimeSpan.FromSeconds(1)); + msg.Should() .Be(Cluster.Get(_sys4).SelfUniqueAddress); }); }); From e672331d178be955600bd4b3183de08754eb8d5e Mon Sep 17 00:00:00 2001 From: Aaron Stannard Date: Fri, 31 May 2024 08:19:17 -0500 Subject: [PATCH 4/5] improvements --- .../Singleton/ClusterSingletonRestart2Spec.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart2Spec.cs b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart2Spec.cs index a4b37052608..74c6c3032a5 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart2Spec.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonRestart2Spec.cs @@ -104,14 +104,14 @@ await WithinAsync(TimeSpan.FromSeconds(5), () => }); Cluster.Get(_sys1).Leave(Cluster.Get(_sys1).SelfAddress); - + + // ReSharper disable once PossibleInvalidOperationException + var sys2Port = Cluster.Get(_sys2).SelfAddress.Port.Value; // grab value before shutdown // at the same time, shutdown sys2, which would be the expected next singleton node Shutdown(_sys2); // it will be downed by the join attempts of the new incarnation // then restart it - // ReSharper disable once PossibleInvalidOperationException - var sys2Port = Cluster.Get(_sys2).SelfAddress.Port.Value; var sys4Config = ConfigurationFactory.ParseString(@"akka.remote.dot-netty.tcp.port=" + sys2Port) .WithFallback(_sys1.Settings.Config); _sys4 = ActorSystem.Create(_sys1.Name, sys4Config); From 590dc76713b6df1d7fdad3b55ec6a0d6b815583c Mon Sep 17 00:00:00 2001 From: Aaron Stannard Date: Fri, 31 May 2024 10:14:45 -0500 Subject: [PATCH 5/5] added logging to `ClusterSingletonLeaseSpec` --- .../Singleton/ClusterSingletonLeaseSpec.cs | 83 ++++++++++--------- src/core/Akka.Coordination.Tests/TestLease.cs | 12 ++- 2 files changed, 47 insertions(+), 48 deletions(-) diff --git a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonLeaseSpec.cs b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonLeaseSpec.cs index a2ef81c5bb5..77c90ceef27 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonLeaseSpec.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Singleton/ClusterSingletonLeaseSpec.cs @@ -24,6 +24,7 @@ using FluentAssertions; using Microsoft.Extensions.Logging; using Xunit; +using Xunit.Abstractions; namespace Akka.Cluster.Tools.Tests.Singleton { @@ -77,14 +78,14 @@ protected TestException(SerializationInfo info, StreamingContext context) } } - private Cluster cluster; - private TestLeaseExt testLeaseExt; + private readonly Cluster _cluster; + private readonly TestLeaseExt _testLeaseExt; - private AtomicCounter counter = new(0); - private TimeSpan shortDuration = TimeSpan.FromMilliseconds(50); - private string leaseOwner; + private readonly AtomicCounter _counter = new(0); + private readonly TimeSpan _shortDuration = TimeSpan.FromMilliseconds(50); + private readonly string _leaseOwner; - public ClusterSingletonLeaseSpec() : base(ConfigurationFactory.ParseString(@" + public ClusterSingletonLeaseSpec(ITestOutputHelper output) : base(ConfigurationFactory.ParseString(@" #akka.loglevel = INFO akka.loglevel = DEBUG akka.actor.provider = ""cluster"" @@ -99,22 +100,22 @@ public ClusterSingletonLeaseSpec() : base(ConfigurationFactory.ParseString(@" hostname = ""127.0.0.1"" port = 0 } - }").WithFallback(TestLease.Configuration)) + }").WithFallback(TestLease.Configuration), output) { - cluster = Cluster.Get(Sys); - testLeaseExt = TestLeaseExt.Get(Sys); + _cluster = Cluster.Get(Sys); + _testLeaseExt = TestLeaseExt.Get(Sys); - leaseOwner = cluster.SelfMember.Address.HostPort(); + _leaseOwner = _cluster.SelfMember.Address.HostPort(); - cluster.Join(cluster.SelfAddress); + _cluster.Join(_cluster.SelfAddress); AwaitAssert(() => { - cluster.SelfMember.Status.ShouldBe(MemberStatus.Up); + _cluster.SelfMember.Status.ShouldBe(MemberStatus.Up); }); } - private string NextName() => $"important-{counter.GetAndIncrement()}"; + private string NextName() => $"important-{_counter.GetAndIncrement()}"; private ClusterSingletonManagerSettings NextSettings() => ClusterSingletonManagerSettings.Create(Sys).WithSingletonName(NextName()); @@ -133,10 +134,10 @@ public void ClusterSingleton_with_lease_should_not_start_until_lease_is_availabl TestLease testLease = null; AwaitAssert(() => { - testLease = testLeaseExt.GetTestLease(LeaseNameFor(settings)); + testLease = _testLeaseExt.GetTestLease(LeaseNameFor(settings)); }); // allow singleton manager to create the lease - probe.ExpectNoMsg(shortDuration); + probe.ExpectNoMsg(_shortDuration); testLease.InitialPromise.SetResult(true); probe.ExpectMsg("preStart"); } @@ -154,12 +155,12 @@ public void ClusterSingleton_with_lease_should_do_not_start_if_lease_acquire_ret TestLease testLease = null; AwaitAssert(() => { - testLease = testLeaseExt.GetTestLease(LeaseNameFor(settings)); + testLease = _testLeaseExt.GetTestLease(LeaseNameFor(settings)); }); // allow singleton manager to create the lease - probe.ExpectNoMsg(shortDuration); + probe.ExpectNoMsg(_shortDuration); testLease.InitialPromise.SetResult(false); - probe.ExpectNoMsg(shortDuration); + probe.ExpectNoMsg(_shortDuration); } [Fact] @@ -175,17 +176,17 @@ public void ClusterSingleton_with_lease_should_retry_trying_to_get_lease_if_acqu TestLease testLease = null; AwaitAssert(() => { - testLease = testLeaseExt.GetTestLease(LeaseNameFor(settings)); + testLease = _testLeaseExt.GetTestLease(LeaseNameFor(settings)); }); // allow singleton manager to create the lease - testLease.Probe.ExpectMsg(new TestLease.AcquireReq(leaseOwner)); - singletonProbe.ExpectNoMsg(shortDuration); - TaskCompletionSource nextResponse = new TaskCompletionSource(); + testLease.Probe.ExpectMsg(new TestLease.AcquireReq(_leaseOwner)); + singletonProbe.ExpectNoMsg(_shortDuration); + var nextResponse = new TaskCompletionSource(); testLease.SetNextAcquireResult(nextResponse.Task); testLease.InitialPromise.SetResult(false); - testLease.Probe.ExpectMsg(new TestLease.AcquireReq(leaseOwner)); - singletonProbe.ExpectNoMsg(shortDuration); + testLease.Probe.ExpectMsg(new TestLease.AcquireReq(_leaseOwner)); + singletonProbe.ExpectNoMsg(_shortDuration); nextResponse.SetResult(true); singletonProbe.ExpectMsg("preStart"); } @@ -203,13 +204,13 @@ public void ClusterSingleton_with_lease_should_do_not_start_if_lease_acquire_fai TestLease testLease = null; AwaitAssert(() => { - testLease = testLeaseExt.GetTestLease(LeaseNameFor(settings)); + testLease = _testLeaseExt.GetTestLease(LeaseNameFor(settings)); }); // allow singleton manager to create the lease - probe.ExpectNoMsg(shortDuration); + probe.ExpectNoMsg(_shortDuration); testLease.InitialPromise.SetException(new TestException("no lease for you")); - probe.ExpectNoMsg(shortDuration); + probe.ExpectNoMsg(_shortDuration); } [Fact] @@ -225,16 +226,16 @@ public void ClusterSingleton_with_lease_should_retry_trying_to_get_lease_if_acqu TestLease testLease = null; AwaitAssert(() => { - testLease = testLeaseExt.GetTestLease(LeaseNameFor(settings)); + testLease = _testLeaseExt.GetTestLease(LeaseNameFor(settings)); }); // allow singleton manager to create the lease - testLease.Probe.ExpectMsg(new TestLease.AcquireReq(leaseOwner)); - singletonProbe.ExpectNoMsg(shortDuration); + testLease.Probe.ExpectMsg(new TestLease.AcquireReq(_leaseOwner)); + singletonProbe.ExpectNoMsg(_shortDuration); TaskCompletionSource nextResponse = new TaskCompletionSource(); testLease.SetNextAcquireResult(nextResponse.Task); testLease.InitialPromise.SetException(new TestException("no lease for you")); - testLease.Probe.ExpectMsg(new TestLease.AcquireReq(leaseOwner)); - singletonProbe.ExpectNoMsg(shortDuration); + testLease.Probe.ExpectMsg(new TestLease.AcquireReq(_leaseOwner)); + singletonProbe.ExpectNoMsg(_shortDuration); nextResponse.SetResult(true); singletonProbe.ExpectMsg("preStart"); } @@ -252,19 +253,19 @@ public void ClusterSingleton_with_lease_should_stop_singleton_if_the_lease_fails TestLease testLease = null; AwaitAssert(() => { - testLease = testLeaseExt.GetTestLease(LeaseNameFor(settings)); + testLease = _testLeaseExt.GetTestLease(LeaseNameFor(settings)); }); // allow singleton manager to create the lease - testLease.Probe.ExpectMsg(new TestLease.AcquireReq(leaseOwner)); + testLease.Probe.ExpectMsg(new TestLease.AcquireReq(_leaseOwner)); testLease.InitialPromise.SetResult(true); lifecycleProbe.ExpectMsg("preStart"); var callback = testLease.GetCurrentCallback(); callback(null); lifecycleProbe.ExpectMsg("postStop"); - testLease.Probe.ExpectMsg(new TestLease.ReleaseReq(leaseOwner)); + testLease.Probe.ExpectMsg(new TestLease.ReleaseReq(_leaseOwner)); // should try and reacquire lease - testLease.Probe.ExpectMsg(new TestLease.AcquireReq(leaseOwner)); + testLease.Probe.ExpectMsg(new TestLease.AcquireReq(_leaseOwner)); lifecycleProbe.ExpectMsg("preStart"); } @@ -281,15 +282,15 @@ public void ClusterSingleton_with_lease_should_release_lease_when_leaving_oldest TestLease testLease = null; AwaitAssert(() => { - testLease = testLeaseExt.GetTestLease(LeaseNameFor(settings)); + testLease = _testLeaseExt.GetTestLease(LeaseNameFor(settings)); }); // allow singleton manager to create the lease - singletonProbe.ExpectNoMsg(shortDuration); - testLease.Probe.ExpectMsg(new TestLease.AcquireReq(leaseOwner)); + singletonProbe.ExpectNoMsg(_shortDuration); + testLease.Probe.ExpectMsg(new TestLease.AcquireReq(_leaseOwner)); testLease.InitialPromise.SetResult(true); singletonProbe.ExpectMsg("preStart"); - cluster.Leave(cluster.SelfAddress); - testLease.Probe.ExpectMsg(new TestLease.ReleaseReq(leaseOwner)); + _cluster.Leave(_cluster.SelfAddress); + testLease.Probe.ExpectMsg(new TestLease.ReleaseReq(_leaseOwner)); } } } diff --git a/src/core/Akka.Coordination.Tests/TestLease.cs b/src/core/Akka.Coordination.Tests/TestLease.cs index 1992bea1be0..1cfedd2058b 100644 --- a/src/core/Akka.Coordination.Tests/TestLease.cs +++ b/src/core/Akka.Coordination.Tests/TestLease.cs @@ -33,27 +33,25 @@ public static TestLeaseExt Get(ActorSystem system) return system.WithExtension(); } - private readonly ExtendedActorSystem _system; - private readonly ConcurrentDictionary testLeases = new(); + private readonly ConcurrentDictionary _testLeases = new(); public TestLeaseExt(ExtendedActorSystem system) { - _system = system; - _system.Settings.InjectTopLevelFallback(LeaseProvider.DefaultConfig()); + system.Settings.InjectTopLevelFallback(LeaseProvider.DefaultConfig()); } public TestLease GetTestLease(string name) { - if (!testLeases.TryGetValue(name, out var lease)) + if (!_testLeases.TryGetValue(name, out var lease)) { - throw new InvalidOperationException($"Test lease {name} has not been set yet. Current leases {string.Join(",", testLeases.Keys)}"); + throw new InvalidOperationException($"Test lease {name} has not been set yet. Current leases {string.Join(",", _testLeases.Keys)}"); } return lease; } public void SetTestLease(string name, TestLease lease) { - testLeases[name] = lease; + _testLeases[name] = lease; } }