use of io.aeron.test.cluster.TestNode in project aeron by real-logic.
the class DynamicMembershipTest method shouldDynamicallyJoinClusterOfThreeNoSnapshotsWithCatchup.
@Test
@InterruptAfter(30)
public void shouldDynamicallyJoinClusterOfThreeNoSnapshotsWithCatchup(final TestInfo testInfo) {
cluster = aCluster().withStaticNodes(3).withDynamicNodes(1).start();
systemTestWatcher.cluster(cluster);
final TestNode leader = cluster.awaitLeader();
final int messageCount = 10;
cluster.connectClient();
cluster.sendMessages(messageCount);
cluster.awaitResponseMessageCount(messageCount);
cluster.awaitServiceMessageCount(leader, messageCount);
final TestNode dynamicMember = cluster.startDynamicNode(3, true);
cluster.awaitServiceMessageCount(dynamicMember, messageCount);
}
use of io.aeron.test.cluster.TestNode in project aeron by real-logic.
the class DynamicMembershipTest method shouldDynamicallyJoinClusterOfThreeWithSnapshotThenSend.
@Test
@InterruptAfter(30)
public void shouldDynamicallyJoinClusterOfThreeWithSnapshotThenSend(final TestInfo testInfo) {
cluster = aCluster().withStaticNodes(3).withDynamicNodes(1).start();
systemTestWatcher.cluster(cluster);
final TestNode leader = cluster.awaitLeader();
final int preSnapshotMessageCount = 10;
final int postSnapshotMessageCount = 7;
final int totalMessageCount = preSnapshotMessageCount + postSnapshotMessageCount;
cluster.connectClient();
cluster.sendMessages(preSnapshotMessageCount);
cluster.awaitResponseMessageCount(preSnapshotMessageCount);
cluster.takeSnapshot(leader);
cluster.awaitSnapshotCount(1);
assertTrue(cluster.client().sendKeepAlive());
final TestNode dynamicMember = cluster.startDynamicNode(3, true);
assertTrue(cluster.client().sendKeepAlive());
awaitElectionClosed(dynamicMember);
assertEquals(FOLLOWER, dynamicMember.role());
cluster.awaitSnapshotLoadedForService(dynamicMember);
assertEquals(preSnapshotMessageCount, dynamicMember.service().messageCount());
cluster.sendMessages(postSnapshotMessageCount);
cluster.awaitResponseMessageCount(totalMessageCount);
cluster.awaitServiceMessageCount(dynamicMember, totalMessageCount);
}
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 shouldCatchUpWithAppointedLeaderWithThreeNodesWithNoSnapshot.
@Test
@InterruptAfter(20)
public void shouldCatchUpWithAppointedLeaderWithThreeNodesWithNoSnapshot() {
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());
final int preCatchupMessageCount = 5;
final int postCatchupMessageCount = 10;
final int totalMessageCount = preCatchupMessageCount + postCatchupMessageCount;
cluster.connectClient();
cluster.sendMessages(preCatchupMessageCount);
cluster.awaitResponseMessageCount(preCatchupMessageCount);
cluster.awaitServicesMessageCount(preCatchupMessageCount);
cluster.stopNode(cluster.node(0));
cluster.sendMessages(postCatchupMessageCount);
cluster.awaitResponseMessageCount(totalMessageCount);
cluster.awaitServicesMessageCount(totalMessageCount);
cluster.stopAllNodes();
cluster.restartAllNodes(false);
cluster.awaitLeader();
cluster.awaitServicesMessageCount(totalMessageCount);
}
use of io.aeron.test.cluster.TestNode in project aeron by real-logic.
the class MultiNodeTest method shouldReplayWithAppointedLeaderWithThreeNodesWithNoSnapshot.
@Test
@InterruptAfter(20)
public void shouldReplayWithAppointedLeaderWithThreeNodesWithNoSnapshot() {
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());
final int messageCount = 10;
cluster.connectClient();
cluster.sendMessages(messageCount);
cluster.awaitResponseMessageCount(messageCount);
cluster.awaitServicesMessageCount(messageCount);
cluster.stopAllNodes();
cluster.restartAllNodes(false);
cluster.awaitLeader();
cluster.awaitServicesMessageCount(messageCount);
}
Aggregations