joshelser commented on code in PR #1431:
URL: https://github.com/apache/phoenix/pull/1431#discussion_r868160395
##########
phoenix-core/src/test/java/org/apache/phoenix/monitoring/MetricUtilTest.java:
##########
@@ -48,4 +52,17 @@ public void testGetMetricsStopWatchWithMetricsFalse() throws
Exception {
LogLevel.OFF, WALL_CLOCK_TIME_MS);
assertFalse(metricsStopWatch.getMetricsEnabled());
}
+
+ @Test
+ //Check that MetricsSystemImpl has a String "prefix" field in the Hadoop
version we test with
+ public void testInternalMetricsField() throws NoSuchFieldException,
+ SecurityException, IllegalArgumentException,
IllegalAccessException {
+ MetricsSystemImpl metrics = (MetricsSystemImpl)
DefaultMetricsSystem.instance();
+ Field prefixField = MetricsSystemImpl.class.getDeclaredField("prefix");
+ prefixField.setAccessible(true);
+ String oldValue = (String)prefixField.get(metrics);
+ prefixField.set(metrics, "dummy");
+ prefixField.set(metrics, oldValue);
+ prefixField.setAccessible(false);
Review Comment:
I was initially just thinking to make this
`MetricUtil.isDefaultMetricsInitialized()` to avoid keeping this unit test
aligned with the code in that method. I guess the likelihood of these drifting
is low :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]