stoty commented on code in PR #1431:
URL: https://github.com/apache/phoenix/pull/1431#discussion_r868191956
##########
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:
isDefaultMetricsInitialized() already has a catch-all section to avoid
failing if the API changes, so it cannot really be tested.
--
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]