@Test
public void testReadIOStats() throws Exception {
FileSystemWrapper dfs = null;
InputStream is = null;
Configuration conf = new Configuration();
conf.set(FileSystem.FS_DEFAULT_NAME_KEY, "file:///");
OpProfileDef profileDef = new OpProfileDef(0 , 0 , 0 );
OperatorStats stats = new OperatorStats(profileDef, null );
stats.startProcessing();
try {
dfs = new FileSystemWrapper(conf, stats, null);
is = dfs.open(new Path(tempFilePath));
byte[] buf = new byte[8000];
while (is.read(buf, 0, buf.length) != -1) {
}
} finally {
stats.stopProcessing();
if (is != null) {
is.close();
}
if (dfs != null) {
dfs.close();
}
}
OperatorProfile operatorProfile = stats.getProfile();
assertTrue("Expected wait time is non-zero, but got zero wait time", operatorProfile.getWaitNanos() > 0);
}