YARN-4168. Fixed a failing test TestLogAggregationService.testLocalFileDeletionOnDiskFull. Contributed by Takashi Ohnishi.

(cherry picked from commit 44bbc50d91)
This commit is contained in:
Vinod Kumar Vavilapalli 2016-04-11 12:11:14 -07:00
parent 3cf7856878
commit 3589b9e10e
1 changed files with 15 additions and 4 deletions

View File

@ -217,16 +217,27 @@ private void verifyLocalFileDeletion(
any(UserGroupInformation.class)); any(UserGroupInformation.class));
verify(delSrvc).delete(eq(user), eq((Path) null), verify(delSrvc).delete(eq(user), eq((Path) null),
eq(new Path(app1LogDir.getAbsolutePath()))); eq(new Path(app1LogDir.getAbsolutePath())));
delSrvc.stop();
String containerIdStr = ConverterUtils.toString(container11); String containerIdStr = ConverterUtils.toString(container11);
File containerLogDir = new File(app1LogDir, containerIdStr); File containerLogDir = new File(app1LogDir, containerIdStr);
int count = 0;
int maxAttempts = 50;
for (String fileType : new String[] { "stdout", "stderr", "syslog" }) { for (String fileType : new String[] { "stdout", "stderr", "syslog" }) {
File f = new File(containerLogDir, fileType); File f = new File(containerLogDir, fileType);
Assert.assertFalse("check "+f, f.exists()); count = 0;
while ((f.exists()) && (count < maxAttempts)) {
count++;
Thread.sleep(100);
}
Assert.assertFalse("File [" + f + "] was not deleted", f.exists());
} }
count = 0;
Assert.assertFalse(app1LogDir.exists()); while ((app1LogDir.exists()) && (count < maxAttempts)) {
count++;
Thread.sleep(100);
}
Assert.assertFalse("Directory [" + app1LogDir + "] was not deleted",
app1LogDir.exists());
Path logFilePath = Path logFilePath =
logAggregationService.getRemoteNodeLogFileForApp(application1, logAggregationService.getRemoteNodeLogFileForApp(application1,