From 036c15d8a38857ec82b248c0d5dbb6972dbc5b89 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Mon, 19 Nov 2018 10:17:05 -0500 Subject: [PATCH] Build: Fix official plugins list (#35661) The list of official plugins accidentally included `qa` projects like, well, `qa` and `amazon-ec2`. This changes the mechanism that we use to build the list and adds a test to catch this. Closes #35623 --- .../elasticsearch/plugins/InstallPluginCommandTests.java | 6 +++++- server/build.gradle | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/distribution/tools/plugin-cli/src/test/java/org/elasticsearch/plugins/InstallPluginCommandTests.java b/distribution/tools/plugin-cli/src/test/java/org/elasticsearch/plugins/InstallPluginCommandTests.java index c93f39902e5..38a52f67b3e 100644 --- a/distribution/tools/plugin-cli/src/test/java/org/elasticsearch/plugins/InstallPluginCommandTests.java +++ b/distribution/tools/plugin-cli/src/test/java/org/elasticsearch/plugins/InstallPluginCommandTests.java @@ -112,6 +112,7 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.empty; +import static org.hamcrest.Matchers.endsWith; import static org.hamcrest.Matchers.hasToString; import static org.hamcrest.Matchers.not; @@ -726,7 +727,7 @@ public class InstallPluginCommandTests extends ESTestCase { assertInstallCleaned(env.v2()); } - public void testOfficialPluginsHelpSorted() throws Exception { + public void testOfficialPluginsHelpSortedAndMissingObviouslyWrongPlugins() throws Exception { MockTerminal terminal = new MockTerminal(); new InstallPluginCommand() { @Override @@ -749,6 +750,9 @@ public class InstallPluginCommandTests extends ESTestCase { assertTrue(prev + " < " + line, prev.compareTo(line) < 0); prev = line; line = reader.readLine(); + // qa is not really a plugin and it shouldn't sneak in + assertThat(line, not(endsWith("qa"))); + assertThat(line, not(endsWith("example"))); } } } diff --git a/server/build.gradle b/server/build.gradle index 1b507e542c4..39579bed288 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -172,9 +172,9 @@ task generateModulesList { } task generatePluginsList { - List plugins = project(':plugins').subprojects - .findAll { it.name.contains('example') == false } - .collect { it.name } + Set plugins = new TreeSet<>(project(':plugins').childProjects.keySet()) + plugins.remove('example') + File pluginsFile = new File(buildDir, 'generated-resources/plugins.txt') processResources.from(pluginsFile) inputs.property('plugins', plugins)