Repository: flink
Updated Branches:
  refs/heads/master 18995c8c7 -> 647b4c577


[FLINK-4145] Harden JMX tests

Use distinct non-default port ranges for all tests.


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/647b4c57
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/647b4c57
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/647b4c57

Branch: refs/heads/master
Commit: 647b4c57781ed33467cd0946a34d63be737d66e8
Parents: 18995c8
Author: zentol <ches...@apache.org>
Authored: Tue Jul 5 09:48:30 2016 +0200
Committer: zentol <ches...@apache.org>
Committed: Tue Jul 5 09:48:30 2016 +0200

----------------------------------------------------------------------
 .../apache/flink/metrics/reporter/JMXReporterTest.java   | 11 +++++++----
 .../flink/runtime/jobmanager/JobManagerMetricTest.java   |  2 ++
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/647b4c57/flink-core/src/test/java/org/apache/flink/metrics/reporter/JMXReporterTest.java
----------------------------------------------------------------------
diff --git 
a/flink-core/src/test/java/org/apache/flink/metrics/reporter/JMXReporterTest.java
 
b/flink-core/src/test/java/org/apache/flink/metrics/reporter/JMXReporterTest.java
index 760ae6c..d3378cc 100644
--- 
a/flink-core/src/test/java/org/apache/flink/metrics/reporter/JMXReporterTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/metrics/reporter/JMXReporterTest.java
@@ -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

http://git-wip-us.apache.org/repos/asf/flink/blob/647b4c57/flink-runtime/src/test/java/org/apache/flink/runtime/jobmanager/JobManagerMetricTest.java
----------------------------------------------------------------------
diff --git 
a/flink-runtime/src/test/java/org/apache/flink/runtime/jobmanager/JobManagerMetricTest.java
 
b/flink-runtime/src/test/java/org/apache/flink/runtime/jobmanager/JobManagerMetricTest.java
index 077f3dc..53548fb 100644
--- 
a/flink-runtime/src/test/java/org/apache/flink/runtime/jobmanager/JobManagerMetricTest.java
+++ 
b/flink-runtime/src/test/java/org/apache/flink/runtime/jobmanager/JobManagerMetricTest.java
@@ -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);
 

Reply via email to