Repository navigation
Convert Akka.Remote.Tests to async - Remove AkkaSpec dependency #5900
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
Changes from all commits
c7ecbc8
2842c97
6e4b5d4
6a5c503
f974fdc
d83ce20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,19 +117,18 @@ private Collaborators GetCollaborators() | |
| private class TestFailureDetector : FailureDetector | ||
| { | ||
| #pragma warning disable CS0420 | ||
| // ReSharper disable once InconsistentNaming | ||
| internal volatile bool isAvailable = true; | ||
| public override bool IsAvailable => Volatile.Read(ref isAvailable); | ||
|
|
||
| // ReSharper disable once InconsistentNaming | ||
| internal volatile bool called; | ||
| public override bool IsMonitoring => Volatile.Read(ref called); | ||
| #pragma warning restore CS0420 | ||
| private volatile bool _isAvailable = true; | ||
| public override bool IsAvailable => Volatile.Read(ref _isAvailable); | ||
| public void SetAvailable(bool available) => Volatile.Write(ref _isAvailable, available); | ||
|
|
||
| private volatile bool _called; | ||
| public override bool IsMonitoring => Volatile.Read(ref _called); | ||
|
|
||
| public override void HeartBeat() | ||
| { | ||
| called = true; | ||
| Volatile.Write(ref _called, true); | ||
| } | ||
| #pragma warning restore CS0420 | ||
| } | ||
|
|
||
| private readonly Config _config; | ||
|
|
@@ -167,7 +166,7 @@ public async Task ProtocolStateActor_must_in_inbound_mode_accept_payload_after_A | |
|
|
||
| reader.Tell(TestAssociate(33), TestActor); | ||
|
|
||
| await AwaitConditionAsync(() => collaborators.FailureDetector.called, DefaultTimeout); | ||
| await AwaitConditionAsync(() => collaborators.FailureDetector.IsMonitoring, DefaultTimeout); | ||
|
|
||
| var wrappedHandle = await ExpectMsgOfAsync(DefaultTimeout, "expected InboundAssociation", o => | ||
| { | ||
|
|
@@ -181,7 +180,7 @@ public async Task ProtocolStateActor_must_in_inbound_mode_accept_payload_after_A | |
|
|
||
| wrappedHandle.ReadHandlerSource.SetResult(new ActorHandleEventListener(TestActor)); | ||
|
|
||
| Assert.True(collaborators.FailureDetector.called); | ||
| Assert.True(collaborators.FailureDetector.IsMonitoring); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to change this to the same assertion if the last change proven to fix the racy condition |
||
|
|
||
| // Heartbeat was sent in response to Associate | ||
| await AwaitConditionAsync(() => LastActivityIsHeartbeat(collaborators.Registry), DefaultTimeout); | ||
|
|
@@ -236,7 +235,8 @@ public async Task ProtocolStateActor_must_in_outbound_mode_delay_readiness_until | |
| failureDetector: collaborators.FailureDetector)); | ||
|
|
||
| await AwaitConditionAsync(() => LastActivityIsAssociate(collaborators.Registry, 42), DefaultTimeout); | ||
| Assert.True(collaborators.FailureDetector.called); | ||
|
|
||
| await AwaitConditionAsync(() => collaborators.FailureDetector.IsMonitoring, DefaultTimeout); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On second thought, its safer to await the condition instead |
||
|
|
||
| //keeps sending heartbeats | ||
| await AwaitConditionAsync(() => LastActivityIsHeartbeat(collaborators.Registry), DefaultTimeout); | ||
|
|
@@ -393,9 +393,7 @@ public async Task ProtocolStateActor_must_disassociate_when_failure_detector_sig | |
| //wait for one heartbeat | ||
| await AwaitConditionAsync(() => LastActivityIsHeartbeat(collaborators.Registry), DefaultTimeout); | ||
|
|
||
| #pragma warning disable CS0420 | ||
| Volatile.Write(ref collaborators.FailureDetector.isAvailable, false); | ||
| #pragma warning restore CS0420 | ||
| collaborators.FailureDetector.SetAvailable(false); | ||
|
|
||
| await ExpectMsgOfAsync("expected Disassociated(DisassociateInfo.Unknown", o => | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Volatile is being accessed inconsistently, make sure that all volatile are accessed properly.