Search in sources :

Example 31 with SimulationTest

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

the class MempoolFillTest method sanity_tests_should_pass.

@Test
@Ignore("Travis not playing nice")
public void sanity_tests_should_pass() {
    SimulationTest simulationTest = bftTestBuilder.build();
    final var runningTest = simulationTest.run();
    final var results = runningTest.awaitCompletion();
    // Post conditions
    assertThat(results).allSatisfy((name, err) -> AssertionsForClassTypes.assertThat(err).isEmpty());
    long invalidCommandsCount = runningTest.getNetwork().getSystemCounters().values().stream().map(s -> s.get(SystemCounters.CounterType.RADIX_ENGINE_INVALID_PROPOSED_COMMANDS)).mapToLong(l -> l).sum();
    assertThat(invalidCommandsCount).isZero();
}
Also used : MempoolFillerStarter(com.radixdlt.harness.simulation.application.MempoolFillerStarter) RadixEngineForksLatestOnlyModule(com.radixdlt.statecomputer.forks.RadixEngineForksLatestOnlyModule) AssertionsForClassTypes(org.assertj.core.api.AssertionsForClassTypes) ECPublicKey(com.radixdlt.crypto.ECPublicKey) TokenIssuance(org.radix.TokenIssuance) ImmutableList(com.google.common.collect.ImmutableList) MempoolConfig(com.radixdlt.mempool.MempoolConfig) AssertionsForInterfaceTypes.assertThat(org.assertj.core.api.AssertionsForInterfaceTypes.assertThat) ConsensusMonitors(com.radixdlt.harness.simulation.monitors.consensus.ConsensusMonitors) Genesis(com.radixdlt.statecomputer.checkpoint.Genesis) TokenUnitConversions(com.radixdlt.application.TokenUnitConversions) SystemCounters(com.radixdlt.counters.SystemCounters) ProvidesIntoSet(com.google.inject.multibindings.ProvidesIntoSet) NetworkOrdering(com.radixdlt.harness.simulation.NetworkOrdering) RadixEngineMonitors(com.radixdlt.harness.simulation.monitors.radix_engine.RadixEngineMonitors) Test(org.junit.Test) MempoolFillerModule(com.radixdlt.integration.targeted.mempool.MempoolFillerModule) ForksModule(com.radixdlt.statecomputer.forks.ForksModule) SimulationTest(com.radixdlt.harness.simulation.SimulationTest) TimeUnit(java.util.concurrent.TimeUnit) NetworkLatencies(com.radixdlt.harness.simulation.NetworkLatencies) Ignore(org.junit.Ignore) MainnetForksModule(com.radixdlt.statecomputer.forks.modules.MainnetForksModule) SyncConfig(com.radixdlt.sync.SyncConfig) LedgerMonitors(com.radixdlt.harness.simulation.monitors.ledger.LedgerMonitors) Condition(org.assertj.core.api.Condition) Optional(java.util.Optional) AbstractModule(com.google.inject.AbstractModule) SimulationTest(com.radixdlt.harness.simulation.SimulationTest) Ignore(org.junit.Ignore) Test(org.junit.Test) SimulationTest(com.radixdlt.harness.simulation.SimulationTest)

Example 32 with SimulationTest

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

the class MempoolFillTest method filler_should_overwhelm_unratelimited_mempool.

@Test
@Ignore("Travis not playing nicely with timeouts so disable for now until fixed.")
public void filler_should_overwhelm_unratelimited_mempool() {
    SimulationTest simulationTest = bftTestBuilder.addOverrideModuleToAllInitialNodes(MempoolConfig.asModule(100, 0)).build();
    final var results = simulationTest.run().awaitCompletion();
    assertThat(results).hasValueSatisfying(new Condition<>(Optional::isPresent, "Error exists"));
}
Also used : SimulationTest(com.radixdlt.harness.simulation.SimulationTest) Ignore(org.junit.Ignore) Test(org.junit.Test) SimulationTest(com.radixdlt.harness.simulation.SimulationTest)

Example 33 with SimulationTest

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

the class SanityTest method sanity_tests_should_pass.

@Test
public void sanity_tests_should_pass() {
    SimulationTest simulationTest = bftTestBuilder.build();
    final var results = simulationTest.run().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 34 with SimulationTest

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

the class SanityTest method sanity_tests_should_pass.

@Test
public void sanity_tests_should_pass() {
    SimulationTest simulationTest = bftTestBuilder.build();
    final var results = simulationTest.run(Duration.ofMinutes(1)).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 35 with SimulationTest

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

the class RandomVoteAndViewTimeoutDropperTest method sanity_test.

/**
 * Tests a configuration of 4 nodes with a dropping proposal adversary Test should fail with
 * GetVertices RPC disabled
 */
@Test
public void sanity_test() {
    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_VERTEX_STORE_FORKS)).mapToLong(l -> l).summaryStatistics();
    System.out.println(statistics);
    assertThat(checkResults).allSatisfy((name, error) -> AssertionsForClassTypes.assertThat(error).isNotPresent());
}
Also used : LongSummaryStatistics(java.util.LongSummaryStatistics) NetworkOrdering(com.radixdlt.harness.simulation.NetworkOrdering) AssertionsForClassTypes(org.assertj.core.api.AssertionsForClassTypes) 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) NetworkLatencies(com.radixdlt.harness.simulation.NetworkLatencies) AssertionsForInterfaceTypes.assertThat(org.assertj.core.api.AssertionsForInterfaceTypes.assertThat) LedgerMonitors(com.radixdlt.harness.simulation.monitors.ledger.LedgerMonitors) ConsensusMonitors(com.radixdlt.harness.simulation.monitors.consensus.ConsensusMonitors) CounterType(com.radixdlt.counters.SystemCounters.CounterType) LongSummaryStatistics(java.util.LongSummaryStatistics) 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