Github user greghogan commented on a diff in the pull request:
https://github.com/apache/flink/pull/5099#discussion_r155625966
--- Diff:
flink-runtime/src/test/java/org/apache/flink/runtime/metrics/MetricRegistryImplTest.java
---
@@ -76,8 +76,27 @@ public void testIsShutdown() {
public void testReporterInstantiation() {
Configuration config = new Configuration();
+ config.setString(ConfigConstants.METRICS_REPORTER_PREFIX +
"test." + ConfigConstants.METRICS_REPORTER_CLASS_SUFFIX,
TestReporter1.class.getName());
+
+ MetricRegistryImpl metricRegistry = new
MetricRegistryImpl(MetricRegistryConfiguration.fromConfiguration(config));
+
+ assertTrue(metricRegistry.getReporters().size() == 1);
+
+ Assert.assertTrue(TestReporter1.wasOpened);
+
+ metricRegistry.shutdown();
+ }
+
+ /**
+ * Verifies that the reporter name list is correctly used to determine
which reporters should be instantiated.
+ */
+ @Test
+ public void testReporterInclusion() {
+ Configuration config = new Configuration();
+
config.setString(MetricOptions.REPORTERS_LIST, "test");
config.setString(ConfigConstants.METRICS_REPORTER_PREFIX +
"test." + ConfigConstants.METRICS_REPORTER_CLASS_SUFFIX,
TestReporter1.class.getName());
+ config.setString(ConfigConstants.METRICS_REPORTER_PREFIX +
"test1." + ConfigConstants.METRICS_REPORTER_CLASS_SUFFIX,
TestReporter1.class.getName());
--- End diff --
Use a `TestReporter2` and verify not opened? Do we need both
`testReporterInstantiation` and `testReporterInclusion`?
---