tibrewalpratik17 commented on code in PR #13991: URL: https://github.com/apache/pinot/pull/13991#discussion_r1760939827
########## pinot-common/src/test/java/org/apache/pinot/common/metrics/AbstractMetricsTest.java: ########## @@ -108,4 +112,154 @@ public void testMultipleGauges() { controllerMetrics.removeGauge(metricName2); Assert.assertTrue(controllerMetrics.getMetricsRegistry().allMetrics().isEmpty()); } + + /** + * Creates and initializes a concrete instance of {@link AbstractMetrics} (in this case, a {@code ControllerMetrics}). + * @return a {@code ControllerMetrics} suitable for testing {@code AbstractMetrics} APIs + */ + private static ControllerMetrics buildTestMetrics() { + PinotConfiguration pinotConfiguration = new PinotConfiguration(); + pinotConfiguration.setProperty(CONFIG_OF_METRICS_FACTORY_CLASS_NAME, + "org.apache.pinot.plugin.metrics.yammer.YammerMetricsFactory"); + PinotMetricUtils.init(pinotConfiguration); + return new ControllerMetrics(new YammerMetricsRegistry()); + } + + /** + * Tests the {@link AbstractMetrics} APIs relating to query phases + */ + @Test + public void testQueryPhases() { + final ControllerMetrics testMetrics = buildTestMetrics(); + final MetricsInspector inspector = new MetricsInspector(testMetrics.getMetricsRegistry()); + + // Establish dummy values to be used in the test + final AbstractMetrics.QueryPhase testPhase = () -> "testPhase"; + Assert.assertEquals(testPhase.getDescription(), ""); Review Comment: we can also assert `testPhase.getTimerName == "testPhase"` and `isGlobal` method too -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org