use of io.aeron.test.cluster.TestNode in project Aeron by real-logic.
the class DynamicMembershipTest method shouldDynamicallyJoinClusterOfThreeNoSnapshotsThenSend.
@Test
@InterruptAfter(30)
public void shouldDynamicallyJoinClusterOfThreeNoSnapshotsThenSend(final TestInfo testInfo) {
cluster = aCluster().withStaticNodes(3).withDynamicNodes(1).start();
systemTestWatcher.cluster(cluster);
final TestNode leader = cluster.awaitLeader();
final TestNode dynamicMember = cluster.startDynamicNode(3, true);
awaitElectionClosed(dynamicMember);
assertEquals(FOLLOWER, dynamicMember.role());
final int messageCount = 10;
cluster.connectClient();
cluster.sendMessages(messageCount);
cluster.awaitResponseMessageCount(messageCount);
cluster.awaitServiceMessageCount(leader, messageCount);
cluster.awaitServiceMessageCount(dynamicMember, messageCount);
}
use of io.aeron.test.cluster.TestNode in project Aeron by real-logic.
the class DynamicMembershipTest method shouldDynamicallyJoinClusterOfThreeWithEmptySnapshot.
@Test
@InterruptAfter(30)
public void shouldDynamicallyJoinClusterOfThreeWithEmptySnapshot(final TestInfo testInfo) {
cluster = aCluster().withStaticNodes(3).withDynamicNodes(1).start();
systemTestWatcher.cluster(cluster);
final TestNode leader = cluster.awaitLeader();
cluster.takeSnapshot(leader);
cluster.awaitSnapshotCount(1);
final TestNode dynamicMember = cluster.startDynamicNode(3, true);
awaitElectionClosed(dynamicMember);
assertEquals(FOLLOWER, dynamicMember.role());
cluster.awaitSnapshotLoadedForService(dynamicMember);
}
use of io.aeron.test.cluster.TestNode in project Aeron by real-logic.
the class DynamicMembershipTest method shouldRemoveFollower.
@Test
@InterruptAfter(30)
public void shouldRemoveFollower(final TestInfo testInfo) {
cluster = aCluster().withStaticNodes(3).start();
systemTestWatcher.cluster(cluster);
final TestNode leader = cluster.awaitLeader();
final TestNode follower = cluster.followers().get(0);
follower.isTerminationExpected(true);
leader.removeMember(follower.index(), false);
cluster.awaitNodeTermination(follower);
cluster.stopNode(follower);
final ClusterMembership clusterMembership = awaitMembershipSize(leader, 2);
assertEquals(leader.index(), clusterMembership.leaderMemberId);
}
use of io.aeron.test.cluster.TestNode in project Aeron by real-logic.
the class DynamicMembershipTest method shouldDynamicallyJoinClusterOfThreeNoSnapshots.
@Test
@InterruptAfter(30)
public void shouldDynamicallyJoinClusterOfThreeNoSnapshots(final TestInfo testInfo) {
cluster = aCluster().withStaticNodes(3).withDynamicNodes(1).start();
systemTestWatcher.cluster(cluster);
final TestNode leader = cluster.awaitLeader();
final TestNode dynamicMember = cluster.startDynamicNode(3, true);
awaitElectionClosed(dynamicMember);
assertEquals(FOLLOWER, dynamicMember.role());
final ClusterMembership clusterMembership = awaitMembershipSize(leader, 4);
assertEquals(leader.index(), clusterMembership.leaderMemberId);
assertEquals("", clusterMembership.passiveMembersStr);
}
use of io.aeron.test.cluster.TestNode in project Aeron by real-logic.
the class MultiNodeTest method shouldElectAppointedLeaderWithThreeNodesWithNoReplayNoSnapshot.
@Test
@InterruptAfter(20)
public void shouldElectAppointedLeaderWithThreeNodesWithNoReplayNoSnapshot() {
final int appointedLeaderIndex = 1;
final TestCluster cluster = aCluster().withStaticNodes(3).withAppointedLeader(appointedLeaderIndex).start();
systemTestWatcher.cluster(cluster);
final TestNode leader = cluster.awaitLeader();
assertEquals(appointedLeaderIndex, leader.index());
assertEquals(Cluster.Role.LEADER, leader.role());
assertEquals(Cluster.Role.FOLLOWER, cluster.node(0).role());
assertEquals(Cluster.Role.FOLLOWER, cluster.node(2).role());
}
Aggregations