This is an automated email from the ASF dual-hosted git repository. khowe pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push: new a4bae5c GEODE-4934: Throw exception if shutdown fails in GfshRule (#1699) a4bae5c is described below commit a4bae5c4e36f7d81fbe72925d0046676a29b45cb Author: Kenneth Howe <kh...@pivotal.io> AuthorDate: Fri Mar 30 09:37:57 2018 -0700 GEODE-4934: Throw exception if shutdown fails in GfshRule (#1699) * GEODE-4934: Throw exception if shutdown fails in GfshRule The conjecture is that we're missing shutdown problems with a test that can cause problems in later tests. This change is an attempt to catch the real error in the sporadic AcceptanceTest failures. Throw the exception if one or more processes failed the shutdown. --- .../geode/test/junit/rules/gfsh/GfshRule.java | 31 ++++++++++++++-------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/geode-junit/src/main/java/org/apache/geode/test/junit/rules/gfsh/GfshRule.java b/geode-junit/src/main/java/org/apache/geode/test/junit/rules/gfsh/GfshRule.java index d5e0815..ef64aa4 100644 --- a/geode-junit/src/main/java/org/apache/geode/test/junit/rules/gfsh/GfshRule.java +++ b/geode-junit/src/main/java/org/apache/geode/test/junit/rules/gfsh/GfshRule.java @@ -40,6 +40,7 @@ import org.apache.geode.test.junit.rules.RequiresGeodeHome; public class GfshRule extends ExternalResource { private static final String DOUBLE_QUOTE = "\""; + private static final String LINE_SEPARATOR = System.getProperty("line.separator"); private TemporaryFolder temporaryFolder = new TemporaryFolder(); private List<GfshExecution> gfshExecutions; @@ -62,17 +63,25 @@ public class GfshRule extends ExternalResource { protected void after() { gfshExecutions.stream().collect(Collectors.toList()).forEach(this::stopMembersQuietly); - gfshExecutions.stream().map(GfshExecution::getProcess).map(Process::destroyForcibly) - .forEach((Process process) -> { - try { - // Process.destroyForcibly() may not terminate immediately - process.waitFor(1, TimeUnit.MINUTES); - } catch (InterruptedException ignore) { - // We ignore this exception so that we still attempt the rest of the cleanup. - } - }); - - temporaryFolder.delete(); + final List<String> shutdownExceptions = new ArrayList<>(); + try { + gfshExecutions.stream().map(GfshExecution::getProcess).map(Process::destroyForcibly) + .forEach((Process process) -> { + try { + // Process.destroyForcibly() may not terminate immediately + process.waitFor(1, TimeUnit.MINUTES); + } catch (InterruptedException ie) { + shutdownExceptions + .add(process.toString() + " failed to shutdown: " + ie.getMessage()); + } + }); + if (!shutdownExceptions.isEmpty()) { + throw new RuntimeException("gfshExecutions processes failed to shutdown" + LINE_SEPARATOR + + String.join(LINE_SEPARATOR, shutdownExceptions)); + } + } finally { + temporaryFolder.delete(); + } } public TemporaryFolder getTemporaryFolder() { -- To stop receiving notification emails like this one, please contact kh...@apache.org.