Repository: kafka Updated Branches: refs/heads/0.9.0 9765354c8 -> 4f2d172a3
KAFKA-2455: Fix failure in kafka.consumer.MetricsTest.testMetricsLeak DelayedFetchMetrics are loaded dynamically in function "onExpiration"; use assertNull(DelayedFetchMetrics) to initialize DelayedFetchMetrics explicitly; Author: jinxing <[email protected]> Author: ZoneMayor <[email protected]> Reviewers: Ismael Juma, Guozhang Wang Closes #694 from ZoneMayor/trunk-KAFKA-2455 (cherry picked from commit e32131ed6fcfaea7e56295ea0b6ddbf8c804460f) Signed-off-by: Guozhang Wang <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/kafka/repo Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/4f2d172a Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/4f2d172a Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/4f2d172a Branch: refs/heads/0.9.0 Commit: 4f2d172a3eaa285fe929218e8826b6450177e9d6 Parents: 9765354 Author: Jin Xing <[email protected]> Authored: Mon Dec 21 10:43:46 2015 -0800 Committer: Guozhang Wang <[email protected]> Committed: Mon Dec 21 10:44:50 2015 -0800 ---------------------------------------------------------------------- core/src/test/scala/unit/kafka/metrics/MetricsTest.scala | 3 +++ 1 file changed, 3 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kafka/blob/4f2d172a/core/src/test/scala/unit/kafka/metrics/MetricsTest.scala ---------------------------------------------------------------------- diff --git a/core/src/test/scala/unit/kafka/metrics/MetricsTest.scala b/core/src/test/scala/unit/kafka/metrics/MetricsTest.scala index d699386..ee41fd7 100644 --- a/core/src/test/scala/unit/kafka/metrics/MetricsTest.scala +++ b/core/src/test/scala/unit/kafka/metrics/MetricsTest.scala @@ -58,6 +58,9 @@ class MetricsTest extends KafkaServerTestHarness with Logging { // force creation not client's specific metrics. createAndShutdownStep("group0", "consumer0", "producer0") + //this assertion is only used for creating the metrics for DelayedFetchMetrics, it should never fail, but should not be removed + assertNotNull(DelayedFetchMetrics) + val countOfStaticMetrics = Metrics.defaultRegistry().allMetrics().keySet().size for (i <- 0 to 5) {
