From 3f5d24ae556540da3745c9fe9786e1037eaa311f Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Tue, 13 Dec 2016 19:10:35 -0500 Subject: [PATCH] Add shutdown hook for closing CLI commands This commit adapts some CLI command tests for some changes in core. Relates elastic/elasticsearch#4342 Original commit: elastic/x-pack-elasticsearch@1e48c1404f7bc23230c9920245e04f8c9bbeef20 --- .../extensions/ListXPackExtensionCommandTests.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/extensions/ListXPackExtensionCommandTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/extensions/ListXPackExtensionCommandTests.java index e3bc08591e8..07269367a19 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/extensions/ListXPackExtensionCommandTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/extensions/ListXPackExtensionCommandTests.java @@ -58,7 +58,12 @@ public class ListXPackExtensionCommandTests extends ESTestCase { static MockTerminal listExtensions(Path home) throws Exception { MockTerminal terminal = new MockTerminal(); - int status = new ListXPackExtensionCommand().main(new String[] { "-Epath.home=" + home }, terminal); + int status = new ListXPackExtensionCommand() { + @Override + protected boolean addShutdownHook() { + return false; + } + }.main(new String[] { "-Epath.home=" + home }, terminal); assertEquals(ExitCodes.OK, status); return terminal; } @@ -68,7 +73,12 @@ public class ListXPackExtensionCommandTests extends ESTestCase { System.arraycopy(args, 0, argsAndHome, 0, args.length); argsAndHome[args.length] = "-Epath.home=" + home; MockTerminal terminal = new MockTerminal(); - int status = new ListXPackExtensionCommand().main(argsAndHome, terminal); + int status = new ListXPackExtensionCommand() { + @Override + protected boolean addShutdownHook() { + return false; + } + }.main(argsAndHome, terminal); assertEquals(ExitCodes.OK, status); return terminal; }