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();
}
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();
}
}
Aggregations