HDFS-10275. TestDataNodeMetrics failing intermittently due to TotalWriteTime counted incorrectly. Contributed by Lin Yiqun.

This commit is contained in:
Walter Su 2016-04-18 20:29:29 +08:00
parent 67523ffcf4
commit ab903029a9

View File

@ -258,10 +258,9 @@ public void testTimeoutMetric() throws Exception {
* and reading causes totalReadTime to move. * and reading causes totalReadTime to move.
* @throws Exception * @throws Exception
*/ */
@Test(timeout=60000) @Test(timeout=120000)
public void testDataNodeTimeSpend() throws Exception { public void testDataNodeTimeSpend() throws Exception {
Configuration conf = new HdfsConfiguration(); Configuration conf = new HdfsConfiguration();
SimulatedFSDataset.setFactory(conf);
MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).build(); MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).build();
try { try {
final FileSystem fs = cluster.getFileSystem(); final FileSystem fs = cluster.getFileSystem();
@ -284,6 +283,7 @@ public Boolean get() {
DFSTestUtil.createFile(fs, new Path("/time.txt." + x.get()), DFSTestUtil.createFile(fs, new Path("/time.txt." + x.get()),
LONG_FILE_LEN, (short) 1, Time.monotonicNow()); LONG_FILE_LEN, (short) 1, Time.monotonicNow());
DFSTestUtil.readFile(fs, new Path("/time.txt." + x.get())); DFSTestUtil.readFile(fs, new Path("/time.txt." + x.get()));
fs.delete(new Path("/time.txt." + x.get()), true);
} catch (IOException ioe) { } catch (IOException ioe) {
LOG.error("Caught IOException while ingesting DN metrics", ioe); LOG.error("Caught IOException while ingesting DN metrics", ioe);
return false; return false;
@ -294,7 +294,7 @@ public Boolean get() {
return endWriteValue > startWriteValue return endWriteValue > startWriteValue
&& endReadValue > startReadValue; && endReadValue > startReadValue;
} }
}, 30, 30000); }, 30, 60000);
} finally { } finally {
if (cluster != null) { if (cluster != null) {
cluster.shutdown(); cluster.shutdown();