Search in sources :

Example 1 with CONFIG_FILE_OPTION_NAME

use of tech.pegasys.teku.cli.BeaconNodeCommand.CONFIG_FILE_OPTION_NAME 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 2 with CONFIG_FILE_OPTION_NAME

use of tech.pegasys.teku.cli.BeaconNodeCommand.CONFIG_FILE_OPTION_NAME in project teku by ConsenSys.

the class BeaconNodeCommandTest method overrideConfigFileValuesIfKeyIsPresentInEnvironmentVariables.

@Test
public void overrideConfigFileValuesIfKeyIsPresentInEnvironmentVariables() throws IOException {
    final Path configFile = createConfigFile();
    final String[] args = { CONFIG_FILE_OPTION_NAME, configFile.toString() };
    beaconNodeCommand = new BeaconNodeCommand(outputWriter, errorWriter, Collections.singletonMap("TEKU_P2P_INTERFACE", "1.2.3.5"), startAction, loggingConfigurator);
    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)

Aggregations

Resources (com.google.common.io.Resources)2 IOException (java.io.IOException)2 URL (java.net.URL)2 UTF_8 (java.nio.charset.StandardCharsets.UTF_8)2 Path (java.nio.file.Path)2 Duration (java.time.Duration)2 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 List (java.util.List)2 Map (java.util.Map)2 Optional (java.util.Optional)2 OptionalInt (java.util.OptionalInt)2 Set (java.util.Set)2 Pattern (java.util.regex.Pattern)2 StringUtils (org.apache.commons.lang3.StringUtils)2 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)2 JVM (org.hyperledger.besu.metrics.StandardMetricCategory.JVM)2 PROCESS (org.hyperledger.besu.metrics.StandardMetricCategory.PROCESS)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 Test (org.junit.jupiter.api.Test)2