Search in sources :

Example 1 with ReporterSetup

use of org.apache.flink.runtime.metrics.ReporterSetup in project flink by apache.

the class PrometheusReporterTest method canStartTwoReportersWhenUsingPortRange.

@Test
void canStartTwoReportersWhenUsingPortRange() throws Exception {
    String portRange = portRangeProvider.next();
    ReporterSetup setup1 = createReporterSetup("test1", portRange);
    ReporterSetup setup2 = createReporterSetup("test2", portRange);
    setup1.getReporter().close();
    setup2.getReporter().close();
}
Also used : ReporterSetup(org.apache.flink.runtime.metrics.ReporterSetup) Test(org.junit.jupiter.api.Test)

Example 2 with ReporterSetup

use of org.apache.flink.runtime.metrics.ReporterSetup in project flink by apache.

the class PrometheusReporterTest method cannotStartTwoReportersOnSamePort.

@Test
void cannotStartTwoReportersOnSamePort() throws Exception {
    ReporterSetup setup1 = createReporterSetup("test1", portRangeProvider.next());
    int usedPort = ((PrometheusReporter) setup1.getReporter()).getPort();
    try {
        assertThatThrownBy(() -> createReporterSetup("test2", String.valueOf(usedPort))).isInstanceOf(Exception.class);
    } finally {
        setup1.getReporter().close();
    }
}
Also used : ReporterSetup(org.apache.flink.runtime.metrics.ReporterSetup) Test(org.junit.jupiter.api.Test)

Aggregations

ReporterSetup (org.apache.flink.runtime.metrics.ReporterSetup)2 Test (org.junit.jupiter.api.Test)2