HDFS-11842. TestDataNodeOutlierDetectionViaMetrics UT fails intermittently. Controbuted by Hanisha Koneru.
This commit is contained in:
parent
27845d5269
commit
c3f029c1d8
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue