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

SplitBrainResolverSpec #5936

Merged
merged 5 commits into from
May 10, 2022
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
28 changes: 14 additions & 14 deletions src/core/Akka.Cluster.Tests/SBR/SplitBrainResolverSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1572,14 +1572,14 @@ public void Split_Brain_Resolver_must_down_unreachable_when_leader()
}

[Fact]
public void Split_Brain_Resolver_must_not_down_unreachable_when_not_leader()
public async Task Split_Brain_Resolver_must_not_down_unreachable_when_not_leader()
{
var setup = new SetupKeepMajority(this, TimeSpan.Zero, MemberB.UniqueAddress, null);
setup.MemberUp(MemberA, MemberB, MemberC);
setup.Leader(MemberA);
setup.Unreachable(MemberC);
setup.Tick();
ExpectNoMsg(500);
await ExpectNoMsgAsync(500);
setup.Stop();
}

Expand All @@ -1597,41 +1597,41 @@ public void Split_Brain_Resolver_must_down_unreachable_when_becoming_leader()
}

[Fact]
public void Split_Brain_Resolver_must_down_unreachable_after_specified_duration()
public async Task Split_Brain_Resolver_must_down_unreachable_after_specified_duration()
{
var setup = new SetupKeepMajority(this, TimeSpan.FromSeconds(2), MemberA.UniqueAddress, null);
setup.MemberUp(MemberA, MemberB, MemberC);
setup.Leader(MemberA);
setup.Unreachable(MemberB);
ExpectNoMsg(1000);
await ExpectNoMsgAsync(1000);
setup.ExpectDownCalled(MemberB);
setup.Stop();
}

[Fact]
public void Split_Brain_Resolver_must_down_unreachable_when_becoming_leader_inbetween_detection_and_specified_duration()
public async Task Split_Brain_Resolver_must_down_unreachable_when_becoming_leader_inbetween_detection_and_specified_duration()
{
var setup = new SetupKeepMajority(this, TimeSpan.FromSeconds(2), MemberA.UniqueAddress, null);
setup.MemberUp(MemberA, MemberB, MemberC);
setup.Leader(MemberB);
setup.Unreachable(MemberC);
setup.Leader(MemberA);
setup.Tick();
ExpectNoMsg(1000);
await ExpectNoMsgAsync(1000);
setup.ExpectDownCalled(MemberC);
setup.Stop();
}

[Fact]
public void Split_Brain_Resolver_must_not_down_unreachable_when_loosing_leadership_inbetween_detection_and_specified_duration()
public async Task Split_Brain_Resolver_must_not_down_unreachable_when_loosing_leadership_inbetween_detection_and_specified_duration()
{
var setup = new SetupKeepMajority(this, TimeSpan.FromSeconds(1), MemberA.UniqueAddress, null);
setup.MemberUp(MemberA, MemberB, MemberC);
setup.Leader(MemberA);
setup.Unreachable(MemberC);
setup.Leader(MemberB);
setup.Tick();
ExpectNoMsg(1500);
await ExpectNoMsgAsync(1500);
setup.Stop();
}

Expand All @@ -1649,40 +1649,40 @@ public void Split_Brain_Resolver_must_down_when_becoming_Weakly_Up_leader()
}

[Fact]
public void Split_Brain_Resolver_must_not_down_when_unreachable_become_reachable_inbetween_detection_and_specified_duration()
public async Task Split_Brain_Resolver_must_not_down_when_unreachable_become_reachable_inbetween_detection_and_specified_duration()
{
var setup = new SetupKeepMajority(this, TimeSpan.FromSeconds(1), MemberA.UniqueAddress, null);
setup.MemberUp(MemberA, MemberB, MemberC);
setup.Leader(MemberA);
setup.Unreachable(MemberB);
setup.Reachable(MemberB);
setup.Tick();
ExpectNoMsg(1500);
await ExpectNoMsgAsync(1500);
setup.Stop();
}

[Fact]
public void Split_Brain_Resolver_must_not_down_when_unreachable_is_removed_inbetween_detection_and_specified_duration()
public async Task Split_Brain_Resolver_must_not_down_when_unreachable_is_removed_inbetween_detection_and_specified_duration()
{
var setup = new SetupKeepMajority(this, TimeSpan.FromSeconds(1), MemberA.UniqueAddress, null);
setup.MemberUp(MemberA, MemberB, MemberC);
setup.Leader(MemberA);
setup.Unreachable(MemberB);
setup.A.Tell(new ClusterEvent.MemberRemoved(MemberB.Copy(MemberStatus.Removed), MemberStatus.Exiting));
setup.Tick();
ExpectNoMsg(1500);
await ExpectNoMsgAsync(1500);
setup.Stop();
}

[Fact]
public void Split_Brain_Resolver_must_not_down_when_unreachable_is_already_Down()
public async Task Split_Brain_Resolver_must_not_down_when_unreachable_is_already_Down()
{
var setup = new SetupKeepMajority(this, TimeSpan.Zero, MemberA.UniqueAddress, null);
setup.MemberUp(MemberA, MemberB, MemberC);
setup.Leader(MemberA);
setup.Unreachable(MemberB.Copy(MemberStatus.Down));
setup.Tick();
ExpectNoMsg(1500);
await ExpectNoMsgAsync(1500);
setup.Stop();
}

Expand Down