From a5b84b2b8284bcdaa649050b5090d79d8b58344c Mon Sep 17 00:00:00 2001 From: Stephan Ewen Date: Thu, 6 Aug 2015 16:55:32 +0200 Subject: [PATCH] [hotfix] Increase timeout for YARN tests to 180 seconds to prevent occasional CI failures. --- .../org/apache/flink/yarn/YarnTestBase.java | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/flink-yarn-tests/src/main/java/org/apache/flink/yarn/YarnTestBase.java b/flink-yarn-tests/src/main/java/org/apache/flink/yarn/YarnTestBase.java index 23b89408109..2d227000f03 100644 --- a/flink-yarn-tests/src/main/java/org/apache/flink/yarn/YarnTestBase.java +++ b/flink-yarn-tests/src/main/java/org/apache/flink/yarn/YarnTestBase.java @@ -425,13 +425,15 @@ public abstract class YarnTestBase { 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(); @@ -448,8 +450,7 @@ public abstract class YarnTestBase { } } // 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 @@ -457,23 +458,28 @@ public abstract class YarnTestBase { 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); -- GitLab