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@1e48c1404f
This commit is contained in:
Jason Tedor 2016-12-13 19:10:35 -05:00 committed by GitHub
parent 1e7985563a
commit 3f5d24ae55
1 changed files with 12 additions and 2 deletions

View File

@ -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;
}