Search in sources :

Example 1 with MetricsConfig

use of tech.pegasys.teku.infrastructure.metrics.MetricsConfig in project teku by ConsenSys.

the class MetricsOptionsTest method metricsEnabled_shouldNotRequireAValue.

@Test
public void metricsEnabled_shouldNotRequireAValue() {
    TekuConfiguration tekuConfiguration = getTekuConfigurationFromArguments("--metrics-enabled");
    final MetricsConfig config = tekuConfiguration.metricsConfig();
    assertThat(config.isMetricsEnabled()).isTrue();
    assertThat(createConfigBuilder().metrics(b -> b.metricsEnabled(true)).build()).usingRecursiveComparison().isEqualTo(tekuConfiguration);
}
Also used : TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) MetricsConfig(tech.pegasys.teku.infrastructure.metrics.MetricsConfig) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 2 with MetricsConfig

use of tech.pegasys.teku.infrastructure.metrics.MetricsConfig in project teku by ConsenSys.

the class MetricsOptionsTest method metricsCategories_shouldAcceptMultipleValues.

@Test
public void metricsCategories_shouldAcceptMultipleValues() {
    TekuConfiguration tekuConfiguration = getTekuConfigurationFromArguments("--metrics-categories", "LIBP2P,NETWORK,EVENTBUS,PROCESS");
    final MetricsConfig config = tekuConfiguration.metricsConfig();
    assertThat(config.getMetricsCategories()).isEqualTo(Set.of(LIBP2P, NETWORK, EVENTBUS, PROCESS));
    assertThat(createConfigBuilder().metrics(b -> b.metricsCategories(Set.of(LIBP2P, NETWORK, EVENTBUS, PROCESS))).build()).usingRecursiveComparison().withComparatorForFields(SET_COMPARATOR, SET_FIELDS).isEqualTo(tekuConfiguration);
}
Also used : Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Set(java.util.Set) EnumSource(org.junit.jupiter.params.provider.EnumSource) EVENTBUS(tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.EVENTBUS) MetricsConfig(tech.pegasys.teku.infrastructure.metrics.MetricsConfig) Test(org.junit.jupiter.api.Test) PROCESS(org.hyperledger.besu.metrics.StandardMetricCategory.PROCESS) LIBP2P(tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.LIBP2P) List(java.util.List) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) TekuMetricCategory(tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory) StandardMetricCategory(org.hyperledger.besu.metrics.StandardMetricCategory) TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) JVM(org.hyperledger.besu.metrics.StandardMetricCategory.JVM) NETWORK(tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.NETWORK) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest) MetricCategory(org.hyperledger.besu.plugin.services.metrics.MetricCategory) Comparator(java.util.Comparator) TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) MetricsConfig(tech.pegasys.teku.infrastructure.metrics.MetricsConfig) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 3 with MetricsConfig

use of tech.pegasys.teku.infrastructure.metrics.MetricsConfig in project teku by ConsenSys.

the class MetricsOptionsTest method metricsCategories_shouldNotBeCaseSensitive.

@Test
public void metricsCategories_shouldNotBeCaseSensitive() {
    final MetricsConfig config = getTekuConfigurationFromArguments("--metrics-categories", "LibP2P,network,EventBUS,PROCESS").metricsConfig();
    assertThat(config.getMetricsCategories()).isEqualTo(Set.of(LIBP2P, NETWORK, EVENTBUS, PROCESS));
}
Also used : MetricsConfig(tech.pegasys.teku.infrastructure.metrics.MetricsConfig) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 4 with MetricsConfig

use of tech.pegasys.teku.infrastructure.metrics.MetricsConfig in project teku by ConsenSys.

the class MetricsOptionsTest method metricsHostAllowlist_shouldNotRequireAValue.

@Test
public void metricsHostAllowlist_shouldNotRequireAValue() {
    TekuConfiguration tekuConfiguration = getTekuConfigurationFromArguments("--metrics-host-allowlist");
    final MetricsConfig config = tekuConfiguration.metricsConfig();
    assertThat(config.getMetricsHostAllowlist()).isEmpty();
    assertThat(createConfigBuilder().metrics(b -> b.metricsHostAllowlist(List.of())).build()).usingRecursiveComparison().isEqualTo(tekuConfiguration);
}
Also used : TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) MetricsConfig(tech.pegasys.teku.infrastructure.metrics.MetricsConfig) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)

Example 5 with MetricsConfig

use of tech.pegasys.teku.infrastructure.metrics.MetricsConfig in project teku by ConsenSys.

the class MetricsOptionsTest method metricsCategories_shouldAcceptStandardMetricCategories.

@ParameterizedTest(name = "{0}")
@EnumSource(StandardMetricCategory.class)
public void metricsCategories_shouldAcceptStandardMetricCategories(MetricCategory category) {
    TekuConfiguration tekuConfiguration = getTekuConfigurationFromArguments("--metrics-categories", category.toString());
    final MetricsConfig config = tekuConfiguration.metricsConfig();
    assertThat(config.getMetricsCategories()).isEqualTo(Set.of(category));
    assertThat(createConfigBuilder().metrics(b -> b.metricsCategories(Set.of(category))).build()).usingRecursiveComparison().withComparatorForFields(SET_COMPARATOR, SET_FIELDS).isEqualTo(tekuConfiguration);
}
Also used : Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Set(java.util.Set) EnumSource(org.junit.jupiter.params.provider.EnumSource) EVENTBUS(tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.EVENTBUS) MetricsConfig(tech.pegasys.teku.infrastructure.metrics.MetricsConfig) Test(org.junit.jupiter.api.Test) PROCESS(org.hyperledger.besu.metrics.StandardMetricCategory.PROCESS) LIBP2P(tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.LIBP2P) List(java.util.List) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) TekuMetricCategory(tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory) StandardMetricCategory(org.hyperledger.besu.metrics.StandardMetricCategory) TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) JVM(org.hyperledger.besu.metrics.StandardMetricCategory.JVM) NETWORK(tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.NETWORK) AbstractBeaconNodeCommandTest(tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest) MetricCategory(org.hyperledger.besu.plugin.services.metrics.MetricCategory) Comparator(java.util.Comparator) TekuConfiguration(tech.pegasys.teku.config.TekuConfiguration) MetricsConfig(tech.pegasys.teku.infrastructure.metrics.MetricsConfig) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Test (org.junit.jupiter.api.Test)9 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)9 AbstractBeaconNodeCommandTest (tech.pegasys.teku.cli.AbstractBeaconNodeCommandTest)9 MetricsConfig (tech.pegasys.teku.infrastructure.metrics.MetricsConfig)9 TekuConfiguration (tech.pegasys.teku.config.TekuConfiguration)7 Comparator (java.util.Comparator)3 List (java.util.List)3 Set (java.util.Set)3 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)3 StandardMetricCategory (org.hyperledger.besu.metrics.StandardMetricCategory)3 JVM (org.hyperledger.besu.metrics.StandardMetricCategory.JVM)3 PROCESS (org.hyperledger.besu.metrics.StandardMetricCategory.PROCESS)3 MetricCategory (org.hyperledger.besu.plugin.services.metrics.MetricCategory)3 EnumSource (org.junit.jupiter.params.provider.EnumSource)3 TekuMetricCategory (tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory)3 EVENTBUS (tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.EVENTBUS)3 LIBP2P (tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.LIBP2P)3 NETWORK (tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.NETWORK)3