More verbose message on preserving plugin config

This commit expands on the message printed when config files are
preserved when removing a plugin to give the user an indication of the
reason the config files are preserved.
This commit is contained in:
Jason Tedor 2016-09-06 08:35:14 -04:00
parent 75956604eb
commit f427d7fe74
2 changed files with 9 additions and 3 deletions

View File

@ -93,7 +93,9 @@ final class RemovePluginCommand extends SettingCommand {
// a message so the user knows in case they want to remove manually
final Path pluginConfigDir = env.configFile().resolve(pluginName);
if (Files.exists(pluginConfigDir)) {
terminal.println("-> Preserving plugin config files: " + pluginConfigDir);
terminal.println(
"-> Preserving plugin config files [" + pluginConfigDir + "] in case of upgrade, delete manually if not needed");
}
}
}

View File

@ -119,7 +119,7 @@ public class RemovePluginCommandTests extends ESTestCase {
Files.createFile(configDir.resolve("fake.yml"));
final MockTerminal terminal = removePlugin("fake", home);
assertTrue(Files.exists(env.configFile().resolve("fake")));
assertThat(terminal.getOutput(), containsString("-> Preserving plugin config files: " + configDir));
assertThat(terminal.getOutput(), containsString(expectedConfigDirPreservedMessage(configDir)));
assertRemoveCleaned(env);
}
@ -127,7 +127,11 @@ public class RemovePluginCommandTests extends ESTestCase {
Files.createDirectories(env.pluginsFile().resolve("fake"));
final Path configDir = env.configFile().resolve("fake");
final MockTerminal terminal = removePlugin("fake", home);
assertThat(terminal.getOutput(), not(containsString("-> Preserving plugin config files: " + configDir)));
assertThat(terminal.getOutput(), not(containsString(expectedConfigDirPreservedMessage(configDir))));
}
private String expectedConfigDirPreservedMessage(final Path configDir) {
return "-> Preserving plugin config files [" + configDir + "] in case of upgrade, delete manually if not needed";
}
}