From 44e9ef2e906bed85d6d660a53980d0b4202506ab Mon Sep 17 00:00:00 2001 From: Arpit Agarwal Date: Wed, 17 May 2017 19:33:37 -0700 Subject: [PATCH] HDFS-11842. TestDataNodeOutlierDetectionViaMetrics UT fails intermittently. Controbuted by Hanisha Koneru. --- .../metrics/TestDataNodeOutlierDetectionViaMetrics.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/metrics/TestDataNodeOutlierDetectionViaMetrics.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/metrics/TestDataNodeOutlierDetectionViaMetrics.java index eb7769e8fd..2cade4b9ba 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/metrics/TestDataNodeOutlierDetectionViaMetrics.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/metrics/TestDataNodeOutlierDetectionViaMetrics.java @@ -18,6 +18,7 @@ package org.apache.hadoop.hdfs.server.datanode.metrics; +import com.google.common.base.Supplier; import org.apache.hadoop.test.GenericTestUtils; import org.apache.log4j.Level; import org.junit.Before; @@ -81,6 +82,13 @@ public void testOutlierIsDetected() throws Exception { // Trigger a snapshot. peerMetrics.dumpSendPacketDownstreamAvgInfoAsJson(); + GenericTestUtils.waitFor(new Supplier() { + @Override + public Boolean get() { + return peerMetrics.getOutliers().size() > 0; + } + }, 500, 100_000); + final Map outliers = peerMetrics.getOutliers(); LOG.info("Got back outlier nodes: {}", outliers); assertThat(outliers.size(), is(1));