HDFS-11842. TestDataNodeOutlierDetectionViaMetrics UT fails intermittently. Controbuted by Hanisha Koneru.

This commit is contained in:
Arpit Agarwal 2017-05-17 19:33:37 -07:00 committed by Xiaoyu Yao
parent 27845d5269
commit c3f029c1d8
1 changed files with 8 additions and 0 deletions

View File

@ -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 class TestDataNodeOutlierDetectionViaMetrics {
// Trigger a snapshot.
peerMetrics.dumpSendPacketDownstreamAvgInfoAsJson();
GenericTestUtils.waitFor(new Supplier<Boolean>() {
@Override
public Boolean get() {
return peerMetrics.getOutliers().size() > 0;
}
}, 500, 100_000);
final Map<String, Double> outliers = peerMetrics.getOutliers();
LOG.info("Got back outlier nodes: {}", outliers);
assertThat(outliers.size(), is(1));