use of io.aeron.test.cluster.TestBackupNode in project Aeron by real-logic.
the class ClusterBackupTest method shouldBackupClusterNoSnapshotsAndNonEmptyLogWithReQuery.
@Test
@InterruptAfter(30)
public void shouldBackupClusterNoSnapshotsAndNonEmptyLogWithReQuery() {
final TestCluster cluster = aCluster().withStaticNodes(3).start();
systemTestWatcher.cluster(cluster);
final TestNode leader = cluster.awaitLeader();
final int messageCount = 10;
cluster.connectClient();
cluster.sendMessages(messageCount);
cluster.awaitResponseMessageCount(messageCount);
cluster.awaitServicesMessageCount(messageCount);
final long logPosition = leader.service().cluster().logPosition();
final TestBackupNode backupNode = cluster.startClusterBackupNode(true);
cluster.awaitBackupState(ClusterBackup.State.BACKING_UP);
cluster.awaitBackupLiveLogPosition(logPosition);
assertTrue(backupNode.nextBackupQueryDeadlineMs(0));
cluster.sendMessages(5);
cluster.awaitResponseMessageCount(messageCount + 5);
cluster.awaitServiceMessageCount(leader, messageCount + 5);
final long nextLogPosition = leader.service().cluster().logPosition();
cluster.awaitBackupState(ClusterBackup.State.BACKING_UP);
cluster.awaitBackupLiveLogPosition(nextLogPosition);
cluster.stopAllNodes();
final TestNode node = cluster.startStaticNodeFromBackup();
cluster.awaitLeader();
assertEquals(messageCount + 5, node.service().messageCount());
}
use of io.aeron.test.cluster.TestBackupNode in project Aeron by real-logic.
the class ClusterBackupTest method shouldBeAbleToGetTimeOfNextBackupQuery.
@Test
@InterruptAfter(30)
public void shouldBeAbleToGetTimeOfNextBackupQuery() {
final TestCluster cluster = aCluster().withStaticNodes(3).start();
systemTestWatcher.cluster(cluster);
cluster.awaitLeader();
final TestBackupNode backupNode = cluster.startClusterBackupNode(true);
cluster.awaitBackupState(ClusterBackup.State.BACKING_UP);
final long nowMs = backupNode.epochClock().time();
assertThat(backupNode.nextBackupQueryDeadlineMs(), greaterThan(nowMs));
}
use of io.aeron.test.cluster.TestBackupNode in project aeron by real-logic.
the class ClusterBackupTest method shouldBackupClusterNoSnapshotsAndNonEmptyLogWithReQuery.
@Test
@InterruptAfter(30)
public void shouldBackupClusterNoSnapshotsAndNonEmptyLogWithReQuery() {
final TestCluster cluster = aCluster().withStaticNodes(3).start();
systemTestWatcher.cluster(cluster);
final TestNode leader = cluster.awaitLeader();
final int messageCount = 10;
cluster.connectClient();
cluster.sendMessages(messageCount);
cluster.awaitResponseMessageCount(messageCount);
cluster.awaitServicesMessageCount(messageCount);
final long logPosition = leader.service().cluster().logPosition();
final TestBackupNode backupNode = cluster.startClusterBackupNode(true);
cluster.awaitBackupState(ClusterBackup.State.BACKING_UP);
cluster.awaitBackupLiveLogPosition(logPosition);
assertTrue(backupNode.nextBackupQueryDeadlineMs(0));
cluster.sendMessages(5);
cluster.awaitResponseMessageCount(messageCount + 5);
cluster.awaitServiceMessageCount(leader, messageCount + 5);
final long nextLogPosition = leader.service().cluster().logPosition();
cluster.awaitBackupState(ClusterBackup.State.BACKING_UP);
cluster.awaitBackupLiveLogPosition(nextLogPosition);
cluster.stopAllNodes();
final TestNode node = cluster.startStaticNodeFromBackup();
cluster.awaitLeader();
assertEquals(messageCount + 5, node.service().messageCount());
}
use of io.aeron.test.cluster.TestBackupNode in project aeron by real-logic.
the class ClusterBackupTest method shouldBeAbleToGetTimeOfNextBackupQuery.
@Test
@InterruptAfter(30)
public void shouldBeAbleToGetTimeOfNextBackupQuery() {
final TestCluster cluster = aCluster().withStaticNodes(3).start();
systemTestWatcher.cluster(cluster);
cluster.awaitLeader();
final TestBackupNode backupNode = cluster.startClusterBackupNode(true);
cluster.awaitBackupState(ClusterBackup.State.BACKING_UP);
final long nowMs = backupNode.epochClock().time();
assertThat(backupNode.nextBackupQueryDeadlineMs(), greaterThan(nowMs));
}
Aggregations