Skip to content

Commit

Permalink
[hotfix] Increase timeout for YARN tests to 180 seconds to prevent oc…
Browse files Browse the repository at this point in the history
…casional CI failures.
  • Loading branch information
StephanEwen committed Aug 6, 2015
1 parent 5a788ec commit a5b84b2
Showing 1 changed file with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,15 @@ protected void runWithArgs(String[] args, String terminateAfterString, String[]
System.setErr(new PrintStream(errContent));


final int START_TIMEOUT_SECONDS = 60;

// we wait for at most three minutes
final int START_TIMEOUT_SECONDS = 180;
final long deadline = System.currentTimeMillis() + (START_TIMEOUT_SECONDS * 1000);

Runner runner = new Runner(args, type);
runner.start();

boolean expectedStringSeen = false;
for(int second = 0; second < START_TIMEOUT_SECONDS; second++) {
do {
sleep(1000);
String outContentString = outContent.toString();
String errContentString = errContent.toString();
Expand All @@ -448,32 +450,36 @@ protected void runWithArgs(String[] args, String terminateAfterString, String[]
}
}
// check output for correct TaskManager startup.
if(outContentString.contains(terminateAfterString)
|| errContentString.contains(terminateAfterString) ) {
if (outContentString.contains(terminateAfterString) || errContentString.contains(terminateAfterString) ) {
expectedStringSeen = true;
LOG.info("Found expected output in redirected streams");
// send "stop" command to command line interface
LOG.info("RunWithArgs: request runner to stop");
runner.sendStop();
// wait for the thread to stop
try {
runner.join(10000);
} catch (InterruptedException e) {
runner.join(30000);
}
catch (InterruptedException e) {
LOG.debug("Interrupted while stopping runner", e);
}
LOG.warn("RunWithArgs runner stopped.");
break;
}
// check if thread died
if(!runner.isAlive()) {
sendOutput();
if(runner.getReturnValue() != 0) {
Assert.fail("Runner thread died before the test was finished. Return value = " + runner.getReturnValue());
} else {
LOG.info("Runner stopped earlier than expected with return value = 0");
else {
// check if thread died
if (!runner.isAlive()) {
sendOutput();
if (runner.getReturnValue() != 0) {
Assert.fail("Runner thread died before the test was finished. Return value = "
+ runner.getReturnValue());
} else {
LOG.info("Runner stopped earlier than expected with return value = 0");
}
}
}
}
while (!expectedStringSeen && System.currentTimeMillis() < deadline);

sendOutput();
Assert.assertTrue("During the timeout period of " + START_TIMEOUT_SECONDS + " seconds the " +
"expected string did not show up", expectedStringSeen);
Expand Down

0 comments on commit a5b84b2

Please sign in to comment.