HDFS-11842. TestDataNodeOutlierDetectionViaMetrics UT fails intermittently. Controbuted by Hanisha Koneru.
This commit is contained in:
parent
ef9e536a71
commit
44e9ef2e90
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package org.apache.hadoop.hdfs.server.datanode.metrics;
|
package org.apache.hadoop.hdfs.server.datanode.metrics;
|
||||||
|
|
||||||
|
import com.google.common.base.Supplier;
|
||||||
import org.apache.hadoop.test.GenericTestUtils;
|
import org.apache.hadoop.test.GenericTestUtils;
|
||||||
import org.apache.log4j.Level;
|
import org.apache.log4j.Level;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@ -81,6 +82,13 @@ public void testOutlierIsDetected() throws Exception {
|
|||||||
// Trigger a snapshot.
|
// Trigger a snapshot.
|
||||||
peerMetrics.dumpSendPacketDownstreamAvgInfoAsJson();
|
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();
|
final Map<String, Double> outliers = peerMetrics.getOutliers();
|
||||||
LOG.info("Got back outlier nodes: {}", outliers);
|
LOG.info("Got back outlier nodes: {}", outliers);
|
||||||
assertThat(outliers.size(), is(1));
|
assertThat(outliers.size(), is(1));
|
||||||
|
Loading…
Reference in New Issue
Block a user