|
|
@@ -259,12 +259,12 @@ public class InstallPluginCommandTests extends ESTestCase {
|
|
|
|
|
|
static Path createPlugin(String name, Path structure, String... additionalProps) throws IOException {
|
|
|
writePlugin(name, structure, additionalProps);
|
|
|
- return writeZip(structure, "elasticsearch");
|
|
|
+ return writeZip(structure, null);
|
|
|
}
|
|
|
|
|
|
static Path createMetaPlugin(String name, Path structure) throws IOException {
|
|
|
writeMetaPlugin(name, structure);
|
|
|
- return writeZip(structure, "elasticsearch");
|
|
|
+ return writeZip(structure, null);
|
|
|
}
|
|
|
|
|
|
void installPlugin(String pluginUrl, Path home) throws Exception {
|
|
|
@@ -811,7 +811,7 @@ public class InstallPluginCommandTests extends ESTestCase {
|
|
|
Path pluginDir = metaDir.resolve("fake");
|
|
|
Files.createDirectory(pluginDir);
|
|
|
Files.createFile(pluginDir.resolve("fake.yml"));
|
|
|
- String pluginZip = writeZip(pluginDir, "elasticsearch").toUri().toURL().toString();
|
|
|
+ String pluginZip = writeZip(pluginDir, null).toUri().toURL().toString();
|
|
|
NoSuchFileException e = expectThrows(NoSuchFileException.class, () -> installPlugin(pluginZip, env.v1()));
|
|
|
assertTrue(e.getMessage(), e.getMessage().contains("plugin-descriptor.properties"));
|
|
|
assertInstallCleaned(env.v2());
|
|
|
@@ -822,23 +822,23 @@ public class InstallPluginCommandTests extends ESTestCase {
|
|
|
assertInstallCleaned(env.v2());
|
|
|
}
|
|
|
|
|
|
- public void testMissingDirectory() throws Exception {
|
|
|
+ public void testContainsIntermediateDirectory() throws Exception {
|
|
|
Tuple<Path, Environment> env = createEnv(fs, temp);
|
|
|
Path pluginDir = createPluginDir(temp);
|
|
|
Files.createFile(pluginDir.resolve(PluginInfo.ES_PLUGIN_PROPERTIES));
|
|
|
- String pluginZip = writeZip(pluginDir, null).toUri().toURL().toString();
|
|
|
+ String pluginZip = writeZip(pluginDir, "elasticsearch").toUri().toURL().toString();
|
|
|
UserException e = expectThrows(UserException.class, () -> installPlugin(pluginZip, env.v1()));
|
|
|
- assertTrue(e.getMessage(), e.getMessage().contains("`elasticsearch` directory is missing in the plugin zip"));
|
|
|
+ assertThat(e.getMessage(), containsString("This plugin was built with an older plugin structure"));
|
|
|
assertInstallCleaned(env.v2());
|
|
|
}
|
|
|
|
|
|
- public void testMissingDirectoryMeta() throws Exception {
|
|
|
+ public void testContainsIntermediateDirectoryMeta() throws Exception {
|
|
|
Tuple<Path, Environment> env = createEnv(fs, temp);
|
|
|
Path pluginDir = createPluginDir(temp);
|
|
|
Files.createFile(pluginDir.resolve(MetaPluginInfo.ES_META_PLUGIN_PROPERTIES));
|
|
|
- String pluginZip = writeZip(pluginDir, null).toUri().toURL().toString();
|
|
|
+ String pluginZip = writeZip(pluginDir, "elasticsearch").toUri().toURL().toString();
|
|
|
UserException e = expectThrows(UserException.class, () -> installPlugin(pluginZip, env.v1()));
|
|
|
- assertTrue(e.getMessage(), e.getMessage().contains("`elasticsearch` directory is missing in the plugin zip"));
|
|
|
+ assertThat(e.getMessage(), containsString("This plugin was built with an older plugin structure"));
|
|
|
assertInstallCleaned(env.v2());
|
|
|
}
|
|
|
|
|
|
@@ -846,11 +846,12 @@ public class InstallPluginCommandTests extends ESTestCase {
|
|
|
Tuple<Path, Environment> env = createEnv(fs, temp);
|
|
|
Path zip = createTempDir().resolve("broken.zip");
|
|
|
try (ZipOutputStream stream = new ZipOutputStream(Files.newOutputStream(zip))) {
|
|
|
- stream.putNextEntry(new ZipEntry("elasticsearch/../blah"));
|
|
|
+ stream.putNextEntry(new ZipEntry("../blah"));
|
|
|
}
|
|
|
String pluginZip = zip.toUri().toURL().toString();
|
|
|
UserException e = expectThrows(UserException.class, () -> installPlugin(pluginZip, env.v1()));
|
|
|
assertTrue(e.getMessage(), e.getMessage().contains("resolving outside of plugin directory"));
|
|
|
+ assertInstallCleaned(env.v2());
|
|
|
}
|
|
|
|
|
|
public void testOfficialPluginsHelpSorted() throws Exception {
|