From 1f28703d936873ce5ecf08091862af7afa6f0340 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Wed, 16 Sep 2015 10:08:18 +0100 Subject: [PATCH] HDFS-9072. Fix random failures in TestJMXGet. (J.Andreina via stevel) --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../src/test/java/org/apache/hadoop/tools/TestJMXGet.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 44fb9852935..c5f83f53584 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1005,6 +1005,9 @@ Release 2.8.0 - UNRELEASED HDFS-9067. o.a.h.hdfs.server.datanode.fsdataset.impl.TestLazyWriter is failing in trunk (Surendra Singh Lilhore via vinayakumarb) + HDFS-9072. Fix random failures in TestJMXGet. + (J.Andreina via stevel) + Release 2.7.2 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tools/TestJMXGet.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tools/TestJMXGet.java index c69e73a0598..aef18fb4850 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tools/TestJMXGet.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tools/TestJMXGet.java @@ -114,10 +114,12 @@ public class TestJMXGet { assertTrue("error printAllValues", checkPrintAllValues(jmx)); //get some data from different source + DFSTestUtil.waitForMetric(jmx, "NumLiveDataNodes", numDatanodes); assertEquals(numDatanodes, Integer.parseInt( jmx.getValue("NumLiveDataNodes"))); assertGauge("CorruptBlocks", Long.parseLong(jmx.getValue("CorruptBlocks")), getMetrics("FSNamesystem")); + DFSTestUtil.waitForMetric(jmx, "NumOpenConnections", numDatanodes); assertEquals(numDatanodes, Integer.parseInt( jmx.getValue("NumOpenConnections"))); @@ -161,6 +163,7 @@ public class TestJMXGet { String serviceName = "DataNode"; jmx.setService(serviceName); jmx.init(); + DFSTestUtil.waitForMetric(jmx, "BytesWritten", fileSize); assertEquals(fileSize, Integer.parseInt(jmx.getValue("BytesWritten"))); cluster.shutdown();