Search in sources :

Example 16 with SimulationTest

use of com.radixdlt.harness.simulation.SimulationTest in project radixdlt by radixdlt.

the class OutOfOrderTest method out_of_order_messaging_should_not_affect_properties_of_system.

@Test
public void out_of_order_messaging_should_not_affect_properties_of_system() {
    SimulationTest test = bftTestBuilder.build();
    final var runningTest = test.run();
    final var checkResults = runningTest.awaitCompletion();
    LongSummaryStatistics statistics = runningTest.getNetwork().getSystemCounters().values().stream().map(s -> s.get(CounterType.BFT_SYNC_REQUESTS_SENT)).mapToLong(l -> l).summaryStatistics();
    logger.info(statistics);
    assertThat(checkResults).allSatisfy((name, error) -> assertThat(error).isNotPresent());
}
Also used : LongSummaryStatistics(java.util.LongSummaryStatistics) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Collection(java.util.Collection) NetworkOrdering(com.radixdlt.harness.simulation.NetworkOrdering) RunWith(org.junit.runner.RunWith) Parameters(org.junit.runners.Parameterized.Parameters) Test(org.junit.Test) NetworkDroppers(com.radixdlt.harness.simulation.NetworkDroppers) SimulationTest(com.radixdlt.harness.simulation.SimulationTest) TimeUnit(java.util.concurrent.TimeUnit) Builder(com.radixdlt.harness.simulation.SimulationTest.Builder) List(java.util.List) NetworkLatencies(com.radixdlt.harness.simulation.NetworkLatencies) Logger(org.apache.logging.log4j.Logger) ConsensusMonitors(com.radixdlt.harness.simulation.monitors.consensus.ConsensusMonitors) CounterType(com.radixdlt.counters.SystemCounters.CounterType) LogManager(org.apache.logging.log4j.LogManager) LongSummaryStatistics(java.util.LongSummaryStatistics) Parameterized(org.junit.runners.Parameterized) SimulationTest(com.radixdlt.harness.simulation.SimulationTest) Test(org.junit.Test) SimulationTest(com.radixdlt.harness.simulation.SimulationTest)

Example 17 with SimulationTest

use of com.radixdlt.harness.simulation.SimulationTest in project radixdlt by radixdlt.

the class RandomLatencyTest method given_4_correct_bfts_in_random_network_and_no_sync__then_all_synchronous_checks_should_pass.

/**
 * Tests a static configuration of 4 nodes with random, high variance in latency
 */
@Test
public void given_4_correct_bfts_in_random_network_and_no_sync__then_all_synchronous_checks_should_pass() {
    SimulationTest test = bftTestBuilder.numNodes(4).build();
    final var runningTest = test.run();
    final var checkResults = runningTest.awaitCompletion();
    assertThat(checkResults).allSatisfy((name, error) -> assertThat(error).isNotPresent());
}
Also used : SimulationTest(com.radixdlt.harness.simulation.SimulationTest) Test(org.junit.Test) SimulationTest(com.radixdlt.harness.simulation.SimulationTest)

Example 18 with SimulationTest

use of com.radixdlt.harness.simulation.SimulationTest in project radixdlt by radixdlt.

the class OneOutOfBoundsTest method sanity_tests_should_pass.

@Test
public void sanity_tests_should_pass() {
    SimulationTest simulationTest = bftTestBuilder.build();
    final var results = simulationTest.run(Duration.ofMinutes(2)).awaitCompletion();
    assertThat(results).allSatisfy((name, err) -> AssertionsForClassTypes.assertThat(err).isEmpty());
}
Also used : SimulationTest(com.radixdlt.harness.simulation.SimulationTest) Test(org.junit.Test) SimulationTest(com.radixdlt.harness.simulation.SimulationTest)

Example 19 with SimulationTest

use of com.radixdlt.harness.simulation.SimulationTest in project radixdlt by radixdlt.

the class FPlusOneOutOfBoundsTest method given_0_out_of_3_nodes_out_of_synchrony_bounds.

/**
 * Tests a configuration of 0 out of 3 nodes out of synchrony bounds
 */
@Test
public void given_0_out_of_3_nodes_out_of_synchrony_bounds() {
    SimulationTest test = bftTestBuilder.numNodes(3).networkModules(NetworkOrdering.inOrder(), NetworkLatencies.fixed(LATENCY_MS)).build();
    final var runningTest = test.run();
    final var checkResults = runningTest.awaitCompletion();
    assertThat(checkResults).allSatisfy((name, error) -> assertThat(error).isNotPresent());
}
Also used : SimulationTest(com.radixdlt.harness.simulation.SimulationTest) Test(org.junit.Test) SimulationTest(com.radixdlt.harness.simulation.SimulationTest)

Example 20 with SimulationTest

use of com.radixdlt.harness.simulation.SimulationTest in project radixdlt by radixdlt.

the class FProposalsPerViewDropperTest method given_get_vertices_enabled__then_test_should_succeed_against_drop_proposal_adversary.

/**
 * Tests a configuration of 4 nodes with a dropping proposal adversary Test should fail with
 * GetVertices RPC disabled
 */
@Test
public void given_get_vertices_enabled__then_test_should_succeed_against_drop_proposal_adversary() {
    SimulationTest test = bftTestBuilder.build();
    final var runningTest = test.run();
    final var checkResults = runningTest.awaitCompletion();
    assertThat(checkResults).allSatisfy((name, error) -> assertThat(error).isNotPresent());
}
Also used : SimulationTest(com.radixdlt.harness.simulation.SimulationTest) Test(org.junit.Test) SimulationTest(com.radixdlt.harness.simulation.SimulationTest)

Aggregations

SimulationTest (com.radixdlt.harness.simulation.SimulationTest)43 Test (org.junit.Test)43 NetworkLatencies (com.radixdlt.harness.simulation.NetworkLatencies)10 NetworkOrdering (com.radixdlt.harness.simulation.NetworkOrdering)10 ConsensusMonitors (com.radixdlt.harness.simulation.monitors.consensus.ConsensusMonitors)10 TimeUnit (java.util.concurrent.TimeUnit)10 Builder (com.radixdlt.harness.simulation.SimulationTest.Builder)9 CounterType (com.radixdlt.counters.SystemCounters.CounterType)8 NetworkDroppers (com.radixdlt.harness.simulation.NetworkDroppers)8 LongSummaryStatistics (java.util.LongSummaryStatistics)8 LedgerMonitors (com.radixdlt.harness.simulation.monitors.ledger.LedgerMonitors)7 AbstractModule (com.google.inject.AbstractModule)6 AssertionsForInterfaceTypes.assertThat (org.assertj.core.api.AssertionsForInterfaceTypes.assertThat)6 SyncConfig (com.radixdlt.sync.SyncConfig)5 AssertionsForClassTypes (org.assertj.core.api.AssertionsForClassTypes)5 LogManager (org.apache.logging.log4j.LogManager)4 Logger (org.apache.logging.log4j.Logger)4 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)4 TypeLiteral (com.google.inject.TypeLiteral)3 ProvidesIntoSet (com.google.inject.multibindings.ProvidesIntoSet)3