提交 647b4c57 编写于 作者: Z zentol

[FLINK-4145] Harden JMX tests

Use distinct non-default port ranges for all tests.
上级 18995c8c
......@@ -38,6 +38,7 @@ import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import java.lang.management.ManagementFactory;
import static org.apache.flink.metrics.MetricRegistry.KEY_METRICS_JMX_PORT;
import static org.apache.flink.metrics.MetricRegistry.KEY_METRICS_REPORTER_CLASS;
import static org.junit.Assert.assertEquals;
......@@ -88,10 +89,10 @@ public class JMXReporterTest extends TestLogger {
JMXReporter rep2 = new JMXReporter();
Configuration cfg1 = new Configuration();
Configuration cfg2 = new Configuration();
cfg1.setString(KEY_METRICS_JMX_PORT, "9020-9035");
rep1.open(cfg1);
rep2.open(cfg2);
rep2.open(cfg1);
rep1.notifyOfAddedMetric(new Gauge<Integer>() {
@Override
......@@ -136,8 +137,10 @@ public class JMXReporterTest extends TestLogger {
JMXReporter rep1 = new JMXReporter();
JMXReporter rep2 = new JMXReporter();
rep1.open(new Configuration());
rep2.open(new Configuration());
Configuration cfg1 = new Configuration();
cfg1.setString(KEY_METRICS_JMX_PORT, "9040-9055");
rep1.open(cfg1);
rep2.open(cfg1);
rep1.notifyOfAddedMetric(new Gauge<Integer>() {
@Override
......
......@@ -37,6 +37,7 @@ import java.lang.management.ManagementFactory;
import java.util.Collections;
import java.util.concurrent.TimeUnit;
import static org.apache.flink.metrics.MetricRegistry.KEY_METRICS_JMX_PORT;
import static org.apache.flink.metrics.MetricRegistry.KEY_METRICS_SCOPE_NAMING_JM_JOB;
import static org.junit.Assert.assertEquals;
......@@ -52,6 +53,7 @@ public class JobManagerMetricTest {
Configuration flinkConfiguration = new Configuration();
flinkConfiguration.setString(KEY_METRICS_SCOPE_NAMING_JM_JOB, "jobmanager.<job_name>");
flinkConfiguration.setString(KEY_METRICS_JMX_PORT, "9060-9075");
TestingCluster flink = new TestingCluster(flinkConfiguration);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册