clolov commented on code in PR #13924: URL: https://github.com/apache/kafka/pull/13924#discussion_r1247880517
########## core/src/test/scala/unit/kafka/log/LogCleanerTest.scala: ########## @@ -83,11 +84,19 @@ class LogCleanerTest { val numMetricsRegistered = LogCleaner.MetricNames.size verify(mockMetricsGroup, times(numMetricsRegistered)).newGauge(anyString(), any()) - // verify that each metric is removed + // verify that each metric in `LogCleaner` is removed LogCleaner.MetricNames.foreach(verify(mockMetricsGroup).removeMetric(_)) + // verify that each metric in `LogCleanerManager` is removed + val mockLogCleanerManagerMetricsGroup = mockMetricsGroupCtor.constructed.get(1) + LogCleanerManager.GaugeMetricNameNoTag.foreach(metricName => verify(mockLogCleanerManagerMetricsGroup).newGauge(ArgumentMatchers.eq(metricName), any())) + LogCleanerManager.GaugeMetricNameWithTag.keySet().asScala.foreach(metricName => verify(mockLogCleanerManagerMetricsGroup).newGauge(ArgumentMatchers.eq(metricName), any(), any())) Review Comment: Sorry, why do you think we will call this multiple times with the same metric name? The way I read this code is that we will get the keys from GaugeMetricNameWithTag and GaugeMetricNameNoTag (which are unique because of the nature of a set and map) and for each one we will verify that it is called only once. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org