Search in sources :

Example 1 with TekuConfiguration

use of tech.pegasys.teku.config.TekuConfiguration in project teku by ConsenSys.

the class BeaconNodeCommand method call.

@Override
public Integer call() {
    try {
        startLogging();
        final TekuConfiguration tekuConfig = tekuConfiguration();
        startAction.start(tekuConfig, false);
        return 0;
    } catch (InvalidConfigurationException | DatabaseStorageException ex) {
        reportUserError(ex);
    } catch (CompletionException e) {
        ExceptionUtil.<Throwable>getCause(e, InvalidConfigurationException.class).or(() -> ExceptionUtil.getCause(e, DatabaseStorageException.class)).ifPresentOrElse(this::reportUserError, () -> reportUnexpectedError(e));
    } catch (Throwable t) {
        reportUnexpectedError(t);
    }
    return 1;
}
Also used : DatabaseStorageException(tech.pegasys.teku.storage.server.DatabaseStorageException) TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) CompletionException(java.util.concurrent.CompletionException) InvalidConfigurationException(tech.pegasys.teku.infrastructure.exceptions.InvalidConfigurationException)

Example 2 with TekuConfiguration

use of tech.pegasys.teku.config.TekuConfiguration in project teku by ConsenSys.

the class DataOptionsTest method dataPath_shouldAcceptNonDefaultValues.

@Test
public void dataPath_shouldAcceptNonDefaultValues() {
    final TekuConfiguration config = getTekuConfigurationFromArguments("--data-path", TEST_PATH.toString());
    assertThat(config.dataConfig().getDataBasePath()).isEqualTo(TEST_PATH);
    assertThat(createConfigBuilder().data(b -> b.dataBasePath(TEST_PATH)).build()).usingRecursiveComparison().isEqualTo(config);
}
Also used : TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) Test(org.junit.jupiter.api.Test) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 3 with TekuConfiguration

use of tech.pegasys.teku.config.TekuConfiguration in project teku by ConsenSys.

the class P2POptionsTest method minimumRandomlySelectedPeerCount_canBeOverriden.

@Test
public void minimumRandomlySelectedPeerCount_canBeOverriden() {
    TekuConfiguration tekuConfiguration = getTekuConfigurationFromArguments("--p2p-peer-lower-bound", "100", "--p2p-peer-upper-bound", "110", "--Xp2p-minimum-randomly-selected-peer-count", "40");
    assertThat(tekuConfiguration.discovery().getMinRandomlySelectedPeers()).isEqualTo(40);
    assertThat(createConfigBuilder().discovery(b -> b.minPeers(100).maxPeers(110).minRandomlySelectedPeers(40)).build()).usingRecursiveComparison().isEqualTo(tekuConfiguration);
}
Also used : TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) Test(org.junit.jupiter.api.Test) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 4 with TekuConfiguration

use of tech.pegasys.teku.config.TekuConfiguration in project teku by ConsenSys.

the class P2POptionsTest method privateKeyFile_shouldBeSettable.

@Test
public void privateKeyFile_shouldBeSettable() {
    TekuConfiguration tekuConfiguration = getTekuConfigurationFromArguments("--p2p-private-key-file", "/some/file");
    assertThat(tekuConfiguration.network().getPrivateKeySource()).containsInstanceOf(FilePrivateKeySource.class);
    assertThat(((FilePrivateKeySource) tekuConfiguration.network().getPrivateKeySource().get()).getFileName()).isEqualTo("/some/file");
    assertThat(createConfigBuilder().network(b -> b.privateKeyFile("/some/file")).build()).usingRecursiveComparison().isEqualTo(tekuConfiguration);
}
Also used : TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) FilePrivateKeySource(tech.pegasys.teku.networking.p2p.network.config.NetworkConfig.FilePrivateKeySource) Test(org.junit.jupiter.api.Test) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 5 with TekuConfiguration

use of tech.pegasys.teku.config.TekuConfiguration in project teku by ConsenSys.

the class P2POptionsTest method p2pUdpPort_shouldDefaultToP2pPortWhenNeitherSet.

@Test
void p2pUdpPort_shouldDefaultToP2pPortWhenNeitherSet() {
    final TekuConfiguration tekuConfig = getTekuConfigurationFromArguments();
    assertThat(tekuConfig.discovery().getListenUdpPort()).isEqualTo(tekuConfig.network().getListenPort());
}
Also used : TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) Test(org.junit.jupiter.api.Test) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Aggregations

TekuConfiguration (tech.pegasys.teku.config.TekuConfiguration)94 Test (org.junit.jupiter.api.Test)88 AbstractBeaconNodeCommandTest (tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)84 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)19 BeaconRestApiConfig (tech.pegasys.teku.beaconrestapi.BeaconRestApiConfig)14 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)12 List (java.util.List)10 Eth2NetworkConfiguration (tech.pegasys.teku.networks.Eth2NetworkConfiguration)9 Optional (java.util.Optional)8 URL (java.net.URL)7 OptionalInt (java.util.OptionalInt)6 Set (java.util.Set)6 JVM (org.hyperledger.besu.metrics.StandardMetricCategory.JVM)6 PROCESS (org.hyperledger.besu.metrics.StandardMetricCategory.PROCESS)6 EVENTBUS (tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.EVENTBUS)6 LIBP2P (tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.LIBP2P)6 NETWORK (tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.NETWORK)6 MetricsConfig (tech.pegasys.teku.infrastructure.metrics.MetricsConfig)5 P2PConfig (tech.pegasys.teku.networking.eth2.P2PConfig)5 DiscoveryConfig (tech.pegasys.teku.networking.p2p.discovery.DiscoveryConfig)5