[test] PluginManager plugin info printing
Also removes @Test in keeping with Elasticsearch's slow migration away from the annotation in favor of test methods named testSomeThing.
This commit is contained in:
parent
fc418de46e
commit
3fa3b1597f
|
@ -172,7 +172,7 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
}
|
}
|
||||||
return zip.toUri().toURL().toString();
|
return zip.toUri().toURL().toString();
|
||||||
}
|
}
|
||||||
@Test
|
|
||||||
public void testThatPluginNameMustBeSupplied() throws IOException {
|
public void testThatPluginNameMustBeSupplied() throws IOException {
|
||||||
Path pluginDir = createTempDir().resolve("fake-plugin");
|
Path pluginDir = createTempDir().resolve("fake-plugin");
|
||||||
String pluginUrl = createPlugin(pluginDir,
|
String pluginUrl = createPlugin(pluginDir,
|
||||||
|
@ -184,7 +184,6 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
assertStatus("install --url " + pluginUrl, USAGE);
|
assertStatus("install --url " + pluginUrl, USAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testLocalPluginInstallWithBinAndConfig() throws Exception {
|
public void testLocalPluginInstallWithBinAndConfig() throws Exception {
|
||||||
String pluginName = "fake-plugin";
|
String pluginName = "fake-plugin";
|
||||||
Path pluginDir = createTempDir().resolve(pluginName);
|
Path pluginDir = createTempDir().resolve(pluginName);
|
||||||
|
@ -193,7 +192,7 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
Files.createFile(pluginDir.resolve("bin").resolve("tool"));
|
Files.createFile(pluginDir.resolve("bin").resolve("tool"));
|
||||||
Files.createDirectories(pluginDir.resolve("config"));
|
Files.createDirectories(pluginDir.resolve("config"));
|
||||||
Files.createFile(pluginDir.resolve("config").resolve("file"));
|
Files.createFile(pluginDir.resolve("config").resolve("file"));
|
||||||
|
|
||||||
String pluginUrl = createPlugin(pluginDir,
|
String pluginUrl = createPlugin(pluginDir,
|
||||||
"description", "fake desc",
|
"description", "fake desc",
|
||||||
"version", "1.0",
|
"version", "1.0",
|
||||||
|
@ -201,7 +200,7 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
"java.version", System.getProperty("java.specification.version"),
|
"java.version", System.getProperty("java.specification.version"),
|
||||||
"jvm", "true",
|
"jvm", "true",
|
||||||
"classname", "FakePlugin");
|
"classname", "FakePlugin");
|
||||||
|
|
||||||
Environment env = initialSettings.v2();
|
Environment env = initialSettings.v2();
|
||||||
Path binDir = env.binFile();
|
Path binDir = env.binFile();
|
||||||
Path pluginBinDir = binDir.resolve(pluginName);
|
Path pluginBinDir = binDir.resolve(pluginName);
|
||||||
|
@ -231,14 +230,13 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
/**
|
/**
|
||||||
* Test for #7890
|
* Test for #7890
|
||||||
*/
|
*/
|
||||||
@Test
|
|
||||||
public void testLocalPluginInstallWithBinAndConfigInAlreadyExistingConfigDir_7890() throws Exception {
|
public void testLocalPluginInstallWithBinAndConfigInAlreadyExistingConfigDir_7890() throws Exception {
|
||||||
String pluginName = "fake-plugin";
|
String pluginName = "fake-plugin";
|
||||||
Path pluginDir = createTempDir().resolve(pluginName);
|
Path pluginDir = createTempDir().resolve(pluginName);
|
||||||
// create config/test.txt with contents 'version1'
|
// create config/test.txt with contents 'version1'
|
||||||
Files.createDirectories(pluginDir.resolve("config"));
|
Files.createDirectories(pluginDir.resolve("config"));
|
||||||
Files.write(pluginDir.resolve("config").resolve("test.txt"), "version1".getBytes(StandardCharsets.UTF_8));
|
Files.write(pluginDir.resolve("config").resolve("test.txt"), "version1".getBytes(StandardCharsets.UTF_8));
|
||||||
|
|
||||||
String pluginUrl = createPlugin(pluginDir,
|
String pluginUrl = createPlugin(pluginDir,
|
||||||
"description", "fake desc",
|
"description", "fake desc",
|
||||||
"version", "1.0",
|
"version", "1.0",
|
||||||
|
@ -246,7 +244,7 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
"java.version", System.getProperty("java.specification.version"),
|
"java.version", System.getProperty("java.specification.version"),
|
||||||
"jvm", "true",
|
"jvm", "true",
|
||||||
"classname", "FakePlugin");
|
"classname", "FakePlugin");
|
||||||
|
|
||||||
Environment env = initialSettings.v2();
|
Environment env = initialSettings.v2();
|
||||||
Path pluginConfigDir = env.configFile().resolve(pluginName);
|
Path pluginConfigDir = env.configFile().resolve(pluginName);
|
||||||
|
|
||||||
|
@ -282,7 +280,7 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
"java.version", System.getProperty("java.specification.version"),
|
"java.version", System.getProperty("java.specification.version"),
|
||||||
"jvm", "true",
|
"jvm", "true",
|
||||||
"classname", "FakePlugin");
|
"classname", "FakePlugin");
|
||||||
|
|
||||||
assertStatusOk(String.format(Locale.ROOT, "install %s --url %s --verbose", pluginName, pluginUrl));
|
assertStatusOk(String.format(Locale.ROOT, "install %s --url %s --verbose", pluginName, pluginUrl));
|
||||||
|
|
||||||
assertFileContent(pluginConfigDir, "test.txt", "version1");
|
assertFileContent(pluginConfigDir, "test.txt", "version1");
|
||||||
|
@ -332,7 +330,6 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
// For #7152
|
// For #7152
|
||||||
@Test
|
|
||||||
public void testLocalPluginInstallWithBinOnly_7152() throws Exception {
|
public void testLocalPluginInstallWithBinOnly_7152() throws Exception {
|
||||||
String pluginName = "fake-plugin";
|
String pluginName = "fake-plugin";
|
||||||
Path pluginDir = createTempDir().resolve(pluginName);
|
Path pluginDir = createTempDir().resolve(pluginName);
|
||||||
|
@ -346,7 +343,7 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
"java.version", System.getProperty("java.specification.version"),
|
"java.version", System.getProperty("java.specification.version"),
|
||||||
"jvm", "true",
|
"jvm", "true",
|
||||||
"classname", "FakePlugin");
|
"classname", "FakePlugin");
|
||||||
|
|
||||||
Environment env = initialSettings.v2();
|
Environment env = initialSettings.v2();
|
||||||
Path binDir = env.binFile();
|
Path binDir = env.binFile();
|
||||||
Path pluginBinDir = binDir.resolve(pluginName);
|
Path pluginBinDir = binDir.resolve(pluginName);
|
||||||
|
@ -356,20 +353,38 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
assertDirectoryExists(pluginBinDir);
|
assertDirectoryExists(pluginBinDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testListInstalledEmpty() throws IOException {
|
public void testListInstalledEmpty() throws IOException {
|
||||||
assertStatusOk("list");
|
assertStatusOk("list");
|
||||||
assertThat(terminal.getTerminalOutput(), hasItem(containsString("No plugin detected")));
|
assertThat(terminal.getTerminalOutput(), hasItem(containsString("No plugin detected")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testListInstalledEmptyWithExistingPluginDirectory() throws IOException {
|
public void testListInstalledEmptyWithExistingPluginDirectory() throws IOException {
|
||||||
Files.createDirectory(initialSettings.v2().pluginsFile());
|
Files.createDirectory(initialSettings.v2().pluginsFile());
|
||||||
assertStatusOk("list");
|
assertStatusOk("list");
|
||||||
assertThat(terminal.getTerminalOutput(), hasItem(containsString("No plugin detected")));
|
assertThat(terminal.getTerminalOutput(), hasItem(containsString("No plugin detected")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
public void testInstallPluginVerbose() throws IOException {
|
||||||
|
String pluginName = "fake-plugin";
|
||||||
|
Path pluginDir = createTempDir().resolve(pluginName);
|
||||||
|
String pluginUrl = createPlugin(pluginDir,
|
||||||
|
"description", "fake desc",
|
||||||
|
"version", "1.0",
|
||||||
|
"elasticsearch.version", Version.CURRENT.toString(),
|
||||||
|
"java.version", System.getProperty("java.specification.version"),
|
||||||
|
"jvm", "true",
|
||||||
|
"classname", "FakePlugin");
|
||||||
|
String command = String.format(Locale.ROOT, "install %s --url %s --verbose", pluginName, pluginUrl);
|
||||||
|
ExitStatus status = new PluginManagerCliParser(terminal).execute(args(command));
|
||||||
|
assertThat("Terminal output was: " + terminal.getTerminalOutput(), status, is(ExitStatus.OK));
|
||||||
|
assertThat(terminal.getTerminalOutput(), hasItem(containsString("Name: fake-plugin")));
|
||||||
|
assertThat(terminal.getTerminalOutput(), hasItem(containsString("Description: fake desc")));
|
||||||
|
assertThat(terminal.getTerminalOutput(), hasItem(containsString("Site: false")));
|
||||||
|
assertThat(terminal.getTerminalOutput(), hasItem(containsString("Version: 1.0")));
|
||||||
|
assertThat(terminal.getTerminalOutput(), hasItem(containsString("JVM: true")));
|
||||||
|
assertThatPluginIsListed(pluginName);
|
||||||
|
}
|
||||||
|
|
||||||
public void testInstallPlugin() throws IOException {
|
public void testInstallPlugin() throws IOException {
|
||||||
String pluginName = "fake-plugin";
|
String pluginName = "fake-plugin";
|
||||||
Path pluginDir = createTempDir().resolve(pluginName);
|
Path pluginDir = createTempDir().resolve(pluginName);
|
||||||
|
@ -380,11 +395,39 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
"java.version", System.getProperty("java.specification.version"),
|
"java.version", System.getProperty("java.specification.version"),
|
||||||
"jvm", "true",
|
"jvm", "true",
|
||||||
"classname", "FakePlugin");
|
"classname", "FakePlugin");
|
||||||
assertStatusOk(String.format(Locale.ROOT, "install %s --url %s --verbose", pluginName, pluginUrl));
|
String command = String.format(Locale.ROOT, "install %s --url %s", pluginName, pluginUrl);
|
||||||
|
ExitStatus status = new PluginManagerCliParser(terminal).execute(args(command));
|
||||||
|
assertThat("Terminal output was: " + terminal.getTerminalOutput(), status, is(ExitStatus.OK));
|
||||||
|
assertThat(terminal.getTerminalOutput(), not(hasItem(containsString("Name: fake-plugin"))));
|
||||||
|
assertThat(terminal.getTerminalOutput(), not(hasItem(containsString("Description:"))));
|
||||||
|
assertThat(terminal.getTerminalOutput(), not(hasItem(containsString("Site:"))));
|
||||||
|
assertThat(terminal.getTerminalOutput(), not(hasItem(containsString("Version:"))));
|
||||||
|
assertThat(terminal.getTerminalOutput(), not(hasItem(containsString("JVM:"))));
|
||||||
assertThatPluginIsListed(pluginName);
|
assertThatPluginIsListed(pluginName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
public void testInstallSitePluginVerbose() throws IOException {
|
||||||
|
String pluginName = "fake-plugin";
|
||||||
|
Path pluginDir = createTempDir().resolve(pluginName);
|
||||||
|
Files.createDirectories(pluginDir.resolve("_site"));
|
||||||
|
Files.createFile(pluginDir.resolve("_site").resolve("somefile"));
|
||||||
|
String pluginUrl = createPlugin(pluginDir,
|
||||||
|
"description", "fake desc",
|
||||||
|
"version", "1.0",
|
||||||
|
"site", "true");
|
||||||
|
String command = String.format(Locale.ROOT, "install %s --url %s --verbose", pluginName, pluginUrl);
|
||||||
|
ExitStatus status = new PluginManagerCliParser(terminal).execute(args(command));
|
||||||
|
assertThat("Terminal output was: " + terminal.getTerminalOutput(), status, is(ExitStatus.OK));
|
||||||
|
assertThat(terminal.getTerminalOutput(), hasItem(containsString("Name: fake-plugin")));
|
||||||
|
assertThat(terminal.getTerminalOutput(), hasItem(containsString("Description: fake desc")));
|
||||||
|
assertThat(terminal.getTerminalOutput(), hasItem(containsString("Site: true")));
|
||||||
|
assertThat(terminal.getTerminalOutput(), hasItem(containsString("Version: 1.0")));
|
||||||
|
assertThat(terminal.getTerminalOutput(), hasItem(containsString("JVM: false")));
|
||||||
|
assertThatPluginIsListed(pluginName);
|
||||||
|
// We want to check that Plugin Manager moves content to _site
|
||||||
|
assertFileExists(initialSettings.v2().pluginsFile().resolve(pluginName).resolve("_site"));
|
||||||
|
}
|
||||||
|
|
||||||
public void testInstallSitePlugin() throws IOException {
|
public void testInstallSitePlugin() throws IOException {
|
||||||
String pluginName = "fake-plugin";
|
String pluginName = "fake-plugin";
|
||||||
Path pluginDir = createTempDir().resolve(pluginName);
|
Path pluginDir = createTempDir().resolve(pluginName);
|
||||||
|
@ -394,13 +437,19 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
"description", "fake desc",
|
"description", "fake desc",
|
||||||
"version", "1.0",
|
"version", "1.0",
|
||||||
"site", "true");
|
"site", "true");
|
||||||
assertStatusOk(String.format(Locale.ROOT, "install %s --url %s --verbose", pluginName, pluginUrl));
|
String command = String.format(Locale.ROOT, "install %s --url %s", pluginName, pluginUrl);
|
||||||
|
ExitStatus status = new PluginManagerCliParser(terminal).execute(args(command));
|
||||||
|
assertThat("Terminal output was: " + terminal.getTerminalOutput(), status, is(ExitStatus.OK));
|
||||||
|
assertThat(terminal.getTerminalOutput(), not(hasItem(containsString("Name: fake-plugin"))));
|
||||||
|
assertThat(terminal.getTerminalOutput(), not(hasItem(containsString("Description:"))));
|
||||||
|
assertThat(terminal.getTerminalOutput(), not(hasItem(containsString("Site:"))));
|
||||||
|
assertThat(terminal.getTerminalOutput(), not(hasItem(containsString("Version:"))));
|
||||||
|
assertThat(terminal.getTerminalOutput(), not(hasItem(containsString("JVM:"))));
|
||||||
assertThatPluginIsListed(pluginName);
|
assertThatPluginIsListed(pluginName);
|
||||||
// We want to check that Plugin Manager moves content to _site
|
// We want to check that Plugin Manager moves content to _site
|
||||||
assertFileExists(initialSettings.v2().pluginsFile().resolve(pluginName).resolve("_site"));
|
assertFileExists(initialSettings.v2().pluginsFile().resolve(pluginName).resolve("_site"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testInstallPluginWithBadChecksum() throws IOException {
|
public void testInstallPluginWithBadChecksum() throws IOException {
|
||||||
String pluginName = "fake-plugin";
|
String pluginName = "fake-plugin";
|
||||||
Path pluginDir = createTempDir().resolve(pluginName);
|
Path pluginDir = createTempDir().resolve(pluginName);
|
||||||
|
@ -441,7 +490,6 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
* We test regular form: username/reponame/version
|
* We test regular form: username/reponame/version
|
||||||
* It should find it in download.elasticsearch.org service
|
* It should find it in download.elasticsearch.org service
|
||||||
*/
|
*/
|
||||||
@Test
|
|
||||||
@Network
|
@Network
|
||||||
@AwaitsFix(bugUrl = "fails with jar hell failures - http://build-us-00.elastic.co/job/es_core_master_oracle_6/519/testReport/")
|
@AwaitsFix(bugUrl = "fails with jar hell failures - http://build-us-00.elastic.co/job/es_core_master_oracle_6/519/testReport/")
|
||||||
public void testInstallPluginWithElasticsearchDownloadService() throws IOException {
|
public void testInstallPluginWithElasticsearchDownloadService() throws IOException {
|
||||||
|
@ -455,7 +503,6 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
* We test regular form: groupId/artifactId/version
|
* We test regular form: groupId/artifactId/version
|
||||||
* It should find it in maven central service
|
* It should find it in maven central service
|
||||||
*/
|
*/
|
||||||
@Test
|
|
||||||
@Network
|
@Network
|
||||||
@AwaitsFix(bugUrl = "fails with jar hell failures - http://build-us-00.elastic.co/job/es_core_master_oracle_6/519/testReport/")
|
@AwaitsFix(bugUrl = "fails with jar hell failures - http://build-us-00.elastic.co/job/es_core_master_oracle_6/519/testReport/")
|
||||||
public void testInstallPluginWithMavenCentral() throws IOException {
|
public void testInstallPluginWithMavenCentral() throws IOException {
|
||||||
|
@ -470,7 +517,6 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
* We test site plugins from github: userName/repoName
|
* We test site plugins from github: userName/repoName
|
||||||
* It should find it on github
|
* It should find it on github
|
||||||
*/
|
*/
|
||||||
@Test
|
|
||||||
@Network @AwaitsFix(bugUrl = "needs to be adapted to 2.0")
|
@Network @AwaitsFix(bugUrl = "needs to be adapted to 2.0")
|
||||||
public void testInstallPluginWithGithub() throws IOException {
|
public void testInstallPluginWithGithub() throws IOException {
|
||||||
assumeTrue("github.com is accessible", isDownloadServiceWorking("github.com", 443, "/"));
|
assumeTrue("github.com is accessible", isDownloadServiceWorking("github.com", 443, "/"));
|
||||||
|
@ -492,10 +538,9 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testRemovePlugin() throws Exception {
|
public void testRemovePlugin() throws Exception {
|
||||||
String pluginName = "plugintest";
|
String pluginName = "plugintest";
|
||||||
Path pluginDir = createTempDir().resolve(pluginName);
|
Path pluginDir = createTempDir().resolve(pluginName);
|
||||||
String pluginUrl = createPlugin(pluginDir,
|
String pluginUrl = createPlugin(pluginDir,
|
||||||
"description", "fake desc",
|
"description", "fake desc",
|
||||||
"version", "1.0.0",
|
"version", "1.0.0",
|
||||||
|
@ -503,7 +548,7 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
"java.version", System.getProperty("java.specification.version"),
|
"java.version", System.getProperty("java.specification.version"),
|
||||||
"jvm", "true",
|
"jvm", "true",
|
||||||
"classname", "FakePlugin");
|
"classname", "FakePlugin");
|
||||||
|
|
||||||
// We want to remove plugin with plugin short name
|
// We want to remove plugin with plugin short name
|
||||||
singlePluginInstallAndRemove("plugintest", "plugintest", pluginUrl);
|
singlePluginInstallAndRemove("plugintest", "plugintest", pluginUrl);
|
||||||
|
|
||||||
|
@ -514,18 +559,15 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
singlePluginInstallAndRemove("groupid/plugintest", "plugintest", pluginUrl);
|
singlePluginInstallAndRemove("groupid/plugintest", "plugintest", pluginUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testRemovePlugin_NullName_ThrowsException() throws IOException {
|
public void testRemovePlugin_NullName_ThrowsException() throws IOException {
|
||||||
assertStatus("remove ", USAGE);
|
assertStatus("remove ", USAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testRemovePluginWithURLForm() throws Exception {
|
public void testRemovePluginWithURLForm() throws Exception {
|
||||||
assertStatus("remove file://whatever", USAGE);
|
assertStatus("remove file://whatever", USAGE);
|
||||||
assertThat(terminal.getTerminalOutput(), hasItem(containsString("Illegal plugin name")));
|
assertThat(terminal.getTerminalOutput(), hasItem(containsString("Illegal plugin name")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testForbiddenPluginNames() throws IOException {
|
public void testForbiddenPluginNames() throws IOException {
|
||||||
assertStatus("remove elasticsearch", USAGE);
|
assertStatus("remove elasticsearch", USAGE);
|
||||||
assertStatus("remove elasticsearch.bat", USAGE);
|
assertStatus("remove elasticsearch.bat", USAGE);
|
||||||
|
@ -537,7 +579,6 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
assertStatus("remove ELASTICSEARCH.IN.SH", USAGE);
|
assertStatus("remove ELASTICSEARCH.IN.SH", USAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testOfficialPluginName_ThrowsException() throws IOException {
|
public void testOfficialPluginName_ThrowsException() throws IOException {
|
||||||
PluginManager.checkForOfficialPlugins("elasticsearch-analysis-icu");
|
PluginManager.checkForOfficialPlugins("elasticsearch-analysis-icu");
|
||||||
PluginManager.checkForOfficialPlugins("elasticsearch-analysis-kuromoji");
|
PluginManager.checkForOfficialPlugins("elasticsearch-analysis-kuromoji");
|
||||||
|
@ -559,13 +600,11 @@ public class PluginManagerIT extends ESIntegTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testThatBasicAuthIsRejectedOnHttp() throws Exception {
|
public void testThatBasicAuthIsRejectedOnHttp() throws Exception {
|
||||||
assertStatus(String.format(Locale.ROOT, "install foo --url http://user:pass@localhost:12345/foo.zip --verbose"), CliTool.ExitStatus.IO_ERROR);
|
assertStatus(String.format(Locale.ROOT, "install foo --url http://user:pass@localhost:12345/foo.zip --verbose"), CliTool.ExitStatus.IO_ERROR);
|
||||||
assertThat(terminal.getTerminalOutput(), hasItem(containsString("Basic auth is only supported for HTTPS!")));
|
assertThat(terminal.getTerminalOutput(), hasItem(containsString("Basic auth is only supported for HTTPS!")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testThatBasicAuthIsSupportedWithHttps() throws Exception {
|
public void testThatBasicAuthIsSupportedWithHttps() throws Exception {
|
||||||
assumeTrue("test requires security manager to be disabled", System.getSecurityManager() == null);
|
assumeTrue("test requires security manager to be disabled", System.getSecurityManager() == null);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue