Search in sources :

Example 1 with FilePrivateKeySource

use of tech.pegasys.teku.networking.p2p.network.config.NetworkConfig.FilePrivateKeySource 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 2 with FilePrivateKeySource

use of tech.pegasys.teku.networking.p2p.network.config.NetworkConfig.FilePrivateKeySource in project teku by ConsenSys.

the class P2POptionsTest method shouldReadFromConfigurationFile.

@Test
public void shouldReadFromConfigurationFile() {
    final TekuConfiguration tekuConfig = getTekuConfigurationFromFile("P2POptions_config.yaml");
    final P2PConfig p2pConfig = tekuConfig.p2p();
    assertThat(p2pConfig.getTargetSubnetSubscriberCount()).isEqualTo(5);
    final DiscoveryConfig discoConfig = tekuConfig.discovery();
    assertThat(discoConfig.isDiscoveryEnabled()).isTrue();
    assertThat(discoConfig.getMinPeers()).isEqualTo(70);
    assertThat(discoConfig.getMaxPeers()).isEqualTo(85);
    assertThat(discoConfig.getMinRandomlySelectedPeers()).isEqualTo(1);
    assertThat(discoConfig.getStaticPeers()).isEqualTo(List.of("127.1.0.1", "127.1.1.1"));
    final NetworkConfig networkConfig = tekuConfig.network();
    assertThat(networkConfig.isEnabled()).isTrue();
    assertThat(networkConfig.getAdvertisedIp()).isEqualTo("127.200.0.1");
    assertThat(networkConfig.getNetworkInterface()).isEqualTo("127.100.0.1");
    assertThat(networkConfig.getListenPort()).isEqualTo(4321);
    assertThat(networkConfig.getPrivateKeySource()).containsInstanceOf(FilePrivateKeySource.class);
    assertThat(((FilePrivateKeySource) networkConfig.getPrivateKeySource().get()).getFileName()).isEqualTo("/the/file");
}
Also used : P2PConfig(tech.pegasys.teku.networking.eth2.P2PConfig) TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) NetworkConfig(tech.pegasys.teku.networking.p2p.network.config.NetworkConfig) DiscoveryConfig(tech.pegasys.teku.networking.p2p.discovery.DiscoveryConfig) FilePrivateKeySource(tech.pegasys.teku.networking.p2p.network.config.NetworkConfig.FilePrivateKeySource) Test(org.junit.jupiter.api.Test) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Aggregations

Test (org.junit.jupiter.api.Test)2 AbstractBeaconNodeCommandTest (tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)2 TekuConfiguration (tech.pegasys.teku.config.TekuConfiguration)2 FilePrivateKeySource (tech.pegasys.teku.networking.p2p.network.config.NetworkConfig.FilePrivateKeySource)2 P2PConfig (tech.pegasys.teku.networking.eth2.P2PConfig)1 DiscoveryConfig (tech.pegasys.teku.networking.p2p.discovery.DiscoveryConfig)1 NetworkConfig (tech.pegasys.teku.networking.p2p.network.config.NetworkConfig)1