Search in sources :

Example 16 with TekuConfiguration

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

the class ExecutionEngineOptionsTest method shouldReadExecutionEngineOptionsFromConfigurationFile.

@Test
public void shouldReadExecutionEngineOptionsFromConfigurationFile() {
    final TekuConfiguration config = getTekuConfigurationFromFile("executionEngineOptions_config.yaml");
    // Spec doesn't include the merge so execution engine is disabled
    assertThat(config.executionEngine().isEnabled()).isFalse();
    assertThat(config.executionEngine().getEndpoint()).isEqualTo("http://example.com:1234/path/");
}
Also used : TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) Test(org.junit.jupiter.api.Test) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 17 with TekuConfiguration

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

the class ExecutionEngineOptionsTest method shouldReportEEEnabledIfSpecEnablesBellatrix.

@Test
public void shouldReportEEEnabledIfSpecEnablesBellatrix() {
    final String[] args = { "--Xnetwork-altair-fork-epoch", "0", "--Xnetwork-bellatrix-fork-epoch", "1", "--Xee-endpoint", "http://example.com:1234/path/" };
    final TekuConfiguration config = getTekuConfigurationFromArguments(args);
    assertThat(config.executionEngine().isEnabled()).isTrue();
    assertThat(createConfigBuilder().eth2NetworkConfig(b -> b.altairForkEpoch(UInt64.ZERO).bellatrixForkEpoch(UInt64.ONE)).executionEngine(b -> b.endpoint("http://example.com:1234/path/")).build()).usingRecursiveComparison().isEqualTo(config);
}
Also used : Test(org.junit.jupiter.api.Test) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) InvalidConfigurationException(tech.pegasys.teku.infrastructure.exceptions.InvalidConfigurationException) MalformedURLException(java.net.MalformedURLException) TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) URL(java.net.URL) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) UInt64(tech.pegasys.teku.infrastructure.unsigned.UInt64) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest) TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) Test(org.junit.jupiter.api.Test) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 18 with TekuConfiguration

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

the class LoggingOptionsTest method wireLoggingOptions_shouldReadFromConfigurationFile.

@Test
public void wireLoggingOptions_shouldReadFromConfigurationFile() {
    final TekuConfiguration config = getTekuConfigurationFromFile("wireLoggingOptions_config.yaml");
    final WireLogsConfig wireConfig = config.network().getWireLogsConfig();
    assertThat(wireConfig.isLogWireCipher()).isTrue();
    assertThat(wireConfig.isLogWirePlain()).isTrue();
    assertThat(wireConfig.isLogWireMuxFrames()).isTrue();
    assertThat(wireConfig.isLogWireGossip()).isTrue();
}
Also used : WireLogsConfig(tech.pegasys.teku.networking.p2p.network.config.WireLogsConfig) TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 19 with TekuConfiguration

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

the class BeaconNodeCommandTest method overrideConfigFileValuesIfKeyIsPresentInCLIOptions.

@Test
public void overrideConfigFileValuesIfKeyIsPresentInCLIOptions() throws IOException {
    final Path configFile = createConfigFile();
    final String[] args = { CONFIG_FILE_OPTION_NAME, configFile.toString(), "--p2p-interface", "1.2.3.5" };
    beaconNodeCommand.parse(args);
    final TekuConfiguration expected = expectedCompleteConfigInFileBuilder().network(n -> n.networkInterface("1.2.3.5")).build();
    assertTekuAndLoggingConfiguration(expected, expectedCompleteConfigInFileLoggingBuilder().build());
}
Also used : Path(java.nio.file.Path) BeforeEach(org.junit.jupiter.api.BeforeEach) PRUNE(tech.pegasys.teku.storage.server.StateStorageMode.PRUNE) URL(java.net.URL) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ValidatorPerformanceTrackingMode(tech.pegasys.teku.validator.api.ValidatorPerformanceTrackingMode) OptionalInt(java.util.OptionalInt) StringUtils(org.apache.commons.lang3.StringUtils) ArrayList(java.util.ArrayList) LIBP2P(tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.LIBP2P) DEFAULT_BOTH(tech.pegasys.teku.infrastructure.logging.LoggingDestination.DEFAULT_BOTH) BEACON(tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.BEACON) Duration(java.time.Duration) Map(java.util.Map) SLASH(tech.pegasys.teku.cli.OSUtils.SLASH) VersionedDatabaseFactory(tech.pegasys.teku.storage.server.VersionedDatabaseFactory) NETWORK(tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.NETWORK) LoggingConfigBuilder(tech.pegasys.teku.infrastructure.logging.LoggingConfig.LoggingConfigBuilder) BOTH(tech.pegasys.teku.infrastructure.logging.LoggingDestination.BOTH) FileBackedGraffitiProvider(tech.pegasys.teku.validator.api.FileBackedGraffitiProvider) Path(java.nio.file.Path) CommandLine(picocli.CommandLine) LOG_FILE_PREFIX(tech.pegasys.teku.cli.BeaconNodeCommand.LOG_FILE_PREFIX) Resources(com.google.common.io.Resources) UTF_8(java.nio.charset.StandardCharsets.UTF_8) NatMethod(tech.pegasys.teku.networking.nat.NatMethod) Set(java.util.Set) IOException(java.io.IOException) EVENTBUS(tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.EVENTBUS) CONFIG_FILE_OPTION_NAME(tech.pegasys.teku.cli.BeaconNodeCommand.CONFIG_FILE_OPTION_NAME) Eth1Address(tech.pegasys.teku.spec.datastructures.eth1.Eth1Address) Test(org.junit.jupiter.api.Test) BeaconRestApiConfig(tech.pegasys.teku.beaconrestapi.BeaconRestApiConfig) PROCESS(org.hyperledger.besu.metrics.StandardMetricCategory.PROCESS) List(java.util.List) TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) Eth2NetworkConfiguration(tech.pegasys.teku.networks.Eth2NetworkConfiguration) DEFAULT_METRICS_CATEGORIES(tech.pegasys.teku.infrastructure.metrics.MetricsConfig.DEFAULT_METRICS_CATEGORIES) DatabaseVersion(tech.pegasys.teku.storage.server.DatabaseVersion) JVM(org.hyperledger.besu.metrics.StandardMetricCategory.JVM) Optional(java.util.Optional) Pattern(java.util.regex.Pattern) LoggingConfig(tech.pegasys.teku.infrastructure.logging.LoggingConfig) Collections(java.util.Collections) InteropConfig(tech.pegasys.teku.validator.api.InteropConfig) TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) Test(org.junit.jupiter.api.Test)

Example 20 with TekuConfiguration

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

the class BeaconNodeCommandTest method assertTekuConfiguration.

private void assertTekuConfiguration(final TekuConfiguration expected) {
    final TekuConfiguration actual = getResultingTekuConfiguration();
    assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
}
Also used : TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration)

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