YARN-330. Fix flakey test: TestNodeManagerShutdown#testKillContainersOnShutdown. Contributed by Sandy Ryza

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1433138 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hitesh Shah 2013-01-14 21:27:39 +00:00
parent 3052ad1f00
commit d7f9f9d177
2 changed files with 12 additions and 2 deletions

View File

@ -185,6 +185,9 @@ Release 2.0.3-alpha - Unreleased
YARN-253. Fixed container-launch to not fail when there are no local
resources to localize. (Tom White via vinodkv)
YARN-330. Fix flakey test: TestNodeManagerShutdown#testKillContainersOnShutdown.
(Sandy Ryza via hitesh)
Release 2.0.2-alpha - 2012-09-07
INCOMPATIBLE CHANGES

View File

@ -138,7 +138,14 @@ public class TestNodeManagerShutdown {
containerManager.getContainerStatus(request).getStatus();
Assert.assertEquals(ContainerState.RUNNING, containerStatus.getState());
try {Thread.sleep(5000);} catch (InterruptedException ex) {ex.printStackTrace();}
final int MAX_TRIES=20;
int numTries = 0;
while (!processStartFile.exists() && numTries < MAX_TRIES) {
try {
Thread.sleep(500);
} catch (InterruptedException ex) {ex.printStackTrace();}
numTries++;
}
nm.stop();
@ -202,7 +209,7 @@ public class TestNodeManagerShutdown {
fileWriter.write("trap \"echo $hello >> " + processStartFile + "\" SIGTERM\n");
fileWriter.write("echo \"Writing pid to start file\"\n");
fileWriter.write("echo $$ >> " + processStartFile + "\n");
fileWriter.write("while true; do\nsleep 1s;\ndone\n");
fileWriter.write("while true; do\ndate >> /dev/null;\n done\n");
fileWriter.close();
return scriptFile;