showuon commented on code in PR #14832:
URL: https://github.com/apache/kafka/pull/14832#discussion_r1418678133
##########
core/src/test/java/kafka/log/remote/RemoteLogManagerTest.java:
##########
@@ -699,22 +702,125 @@ void testRemoteLogManagerTasksAvgIdlePercentMetrics()
throws Exception {
Partition mockFollowerPartition =
mockPartition(followerTopicIdPartition);
// before running tasks, the remote log manager tasks should be all
idle
- assertEquals(1.0,
yammerMetricValue("RemoteLogManagerTasksAvgIdlePercent"));
+ assertEquals(1.0, (double)
yammerMetricValue("RemoteLogManagerTasksAvgIdlePercent"));
+ Map<MetricName, Metric> metricNameMetricMapBefore =
KafkaYammerMetrics.defaultRegistry().allMetrics();
remoteLogManager.onLeadershipChange(Collections.singleton(mockLeaderPartition),
Collections.singleton(mockFollowerPartition), topicIds);
- assertTrue(yammerMetricValue("RemoteLogManagerTasksAvgIdlePercent") <
1.0);
+ Map<MetricName, Metric> metricNameMetricMapAfter =
KafkaYammerMetrics.defaultRegistry().allMetrics();
+ assertTrue((double)
yammerMetricValue("RemoteLogManagerTasksAvgIdlePercent") < 1.0);
// unlock copyLogSegmentData
latch.countDown();
}
- private double yammerMetricValue(String name) {
- Gauge<Double> gauge = (Gauge)
KafkaYammerMetrics.defaultRegistry().allMetrics().entrySet().stream()
+ @Test
+ void testRemoteLogManagerRemoteCopyLagBytes() throws Exception {
Review Comment:
Nice test. Thanks for adding it.
--
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]