Search in sources :

Example 1 with MockedRecoveryModule

use of com.radixdlt.recovery.MockedRecoveryModule in project radixdlt by radixdlt.

the class OneByzantineGenesisTest method given_3_correct_bfts_and_1_byzantine__then_should_make_progress.

@Test
public void given_3_correct_bfts_and_1_byzantine__then_should_make_progress() {
    SimulationTest bftTest = bftTestBuilder.numNodes(4).addOverrideModuleToInitialNodes(nodes -> ImmutableList.of(nodes.get(0).getPublicKey()), new MockedRecoveryModule(HashUtils.random256())).addTestModules(ConsensusMonitors.liveness(5, TimeUnit.SECONDS)).build();
    final var checkResults = bftTest.run().awaitCompletion();
    assertThat(checkResults).allSatisfy((name, err) -> assertThat(err).isEmpty());
}
Also used : SimulationTest(com.radixdlt.harness.simulation.SimulationTest) MockedRecoveryModule(com.radixdlt.recovery.MockedRecoveryModule) Test(org.junit.Test) SimulationTest(com.radixdlt.harness.simulation.SimulationTest)

Example 2 with MockedRecoveryModule

use of com.radixdlt.recovery.MockedRecoveryModule in project radixdlt by radixdlt.

the class OneByzantineGenesisTest method given_2_correct_bfts_and_1_byzantine__then_should_never_make_progress.

@Test
public void given_2_correct_bfts_and_1_byzantine__then_should_never_make_progress() {
    SimulationTest bftTest = bftTestBuilder.numNodes(3).addOverrideModuleToInitialNodes(nodes -> ImmutableList.of(nodes.get(0).getPublicKey()), new MockedRecoveryModule(HashUtils.random256())).addTestModules(ConsensusMonitors.noneCommitted()).build();
    final var checkResults = bftTest.run().awaitCompletion();
    assertThat(checkResults).allSatisfy((name, err) -> AssertionsForClassTypes.assertThat(err).isEmpty());
}
Also used : SimulationTest(com.radixdlt.harness.simulation.SimulationTest) MockedRecoveryModule(com.radixdlt.recovery.MockedRecoveryModule) Test(org.junit.Test) SimulationTest(com.radixdlt.harness.simulation.SimulationTest)

Aggregations

SimulationTest (com.radixdlt.harness.simulation.SimulationTest)2 MockedRecoveryModule (com.radixdlt.recovery.MockedRecoveryModule)2 Test (org.junit.Test)2