Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable plugincli feature #101

Merged
merged 2 commits into from
Feb 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,16 @@ void execute(Terminal terminal, List<String> pluginIds, boolean isBatch, Environ

/** Downloads the plugin and returns the file it was downloaded to. */
private Path download(Terminal terminal, String pluginId, Path tmpDir, boolean isBatch) throws Exception {
if (OFFICIAL_PLUGINS.contains(pluginId)) {
final String url = getElasticUrl(terminal, getStagingHash(), Version.CURRENT, isSnapshot(), pluginId, Platforms.PLATFORM_NAME);
terminal.println("-> Downloading " + pluginId + " from elastic");
return downloadAndValidate(terminal, url, tmpDir, true, isBatch);
}
//
// Disabled installing of plugins by name (https://github.com/opendistro-for-elasticsearch/search/issues/71)
// TODO: Once we have the new artifacts repository URL, We will uncomment this section and update the URLs.
// https://github.com/opendistro-for-elasticsearch/search/issues/100
//
// if (OFFICIAL_PLUGINS.contains(pluginId)) {
// final String url = getElasticUrl(terminal, getStagingHash(), Version.CURRENT, isSnapshot(), pluginId, Platforms.PLATFORM_NAME);
// terminal.println("-> Downloading " + pluginId + " from elastic");
// return downloadAndValidate(terminal, url, tmpDir, true, isBatch);
// }

// now try as maven coordinates, a valid URL would only have a colon and slash
String[] coordinates = pluginId.split(":");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -990,13 +990,15 @@ public void assertInstallPluginFromUrl(
);
}

@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100")
public void testOfficialPlugin() throws Exception {
String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-"
+ Build.CURRENT.getQualifiedVersion()
+ ".zip";
assertInstallPluginFromUrl("analysis-icu", "analysis-icu", url, null, false);
}

@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100")
public void testOfficialPluginSnapshot() throws Exception {
String url = String.format(
Locale.ROOT,
Expand All @@ -1007,6 +1009,7 @@ public void testOfficialPluginSnapshot() throws Exception {
assertInstallPluginFromUrl("analysis-icu", "analysis-icu", url, "abc123", true);
}

@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100")
public void testInstallReleaseBuildOfPluginOnSnapshotBuild() {
String url = String.format(
Locale.ROOT,
Expand All @@ -1026,6 +1029,7 @@ public void testInstallReleaseBuildOfPluginOnSnapshotBuild() {
);
}

@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100")
public void testOfficialPluginStaging() throws Exception {
String url = "https://staging.elastic.co/"
+ Version.CURRENT
Expand All @@ -1035,6 +1039,7 @@ public void testOfficialPluginStaging() throws Exception {
assertInstallPluginFromUrl("analysis-icu", "analysis-icu", url, "abc123", false);
}

@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100")
public void testOfficialPlatformPlugin() throws Exception {
String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-"
+ Platforms.PLATFORM_NAME
Expand All @@ -1044,6 +1049,7 @@ public void testOfficialPlatformPlugin() throws Exception {
assertInstallPluginFromUrl("analysis-icu", "analysis-icu", url, null, false);
}

@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100")
public void testOfficialPlatformPluginSnapshot() throws Exception {
String url = String.format(
Locale.ROOT,
Expand All @@ -1055,6 +1061,7 @@ public void testOfficialPlatformPluginSnapshot() throws Exception {
assertInstallPluginFromUrl("analysis-icu", "analysis-icu", url, "abc123", true);
}

@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100")
public void testOfficialPlatformPluginStaging() throws Exception {
String url = "https://staging.elastic.co/"
+ Version.CURRENT
Expand Down Expand Up @@ -1099,6 +1106,7 @@ public void testMavenChecksumWithoutFilename() throws Exception {
);
}

@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100")
public void testOfficialChecksumWithoutFilename() throws Exception {
String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-"
+ Build.CURRENT.getQualifiedVersion()
Expand All @@ -1122,6 +1130,7 @@ public void testOfficialChecksumWithoutFilename() throws Exception {
assertThat(e.getMessage(), startsWith("Invalid checksum file"));
}

@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100")
public void testOfficialShaMissing() throws Exception {
String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-"
+ Build.CURRENT.getQualifiedVersion()
Expand Down Expand Up @@ -1165,6 +1174,7 @@ public void testMavenShaMissing() throws Exception {
assertEquals("Plugin checksum missing: " + url + ".sha1", e.getMessage());
}

@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100")
public void testInvalidShaFileMissingFilename() throws Exception {
String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-"
+ Build.CURRENT.getQualifiedVersion()
Expand All @@ -1188,6 +1198,7 @@ public void testInvalidShaFileMissingFilename() throws Exception {
assertTrue(e.getMessage(), e.getMessage().startsWith("Invalid checksum file"));
}

@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100")
public void testInvalidShaFileMismatchFilename() throws Exception {
String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-"
+ Build.CURRENT.getQualifiedVersion()
Expand All @@ -1211,6 +1222,7 @@ public void testInvalidShaFileMismatchFilename() throws Exception {
assertThat(e, hasToString(matches("checksum file at \\[.*\\] is not for this plugin")));
}

@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100")
public void testInvalidShaFileContainingExtraLine() throws Exception {
String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-"
+ Build.CURRENT.getQualifiedVersion()
Expand All @@ -1234,6 +1246,7 @@ public void testInvalidShaFileContainingExtraLine() throws Exception {
assertTrue(e.getMessage(), e.getMessage().startsWith("Invalid checksum file"));
}

@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100")
public void testSha512Mismatch() throws Exception {
String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-"
+ Build.CURRENT.getQualifiedVersion()
Expand Down Expand Up @@ -1276,6 +1289,7 @@ public void testSha1Mismatch() throws Exception {
assertTrue(e.getMessage(), e.getMessage().contains("SHA-1 mismatch, expected foobar"));
}

@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100")
public void testPublicKeyIdMismatchToExpectedPublicKeyId() throws Exception {
final String icu = "analysis-icu";
final String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/"
Expand Down Expand Up @@ -1311,6 +1325,7 @@ public void testPublicKeyIdMismatchToExpectedPublicKeyId() throws Exception {
assertThat(e, hasToString(containsString("key id [" + actualID + "] does not match expected key id [" + expectedID + "]")));
}

@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100")
public void testFailedSignatureVerification() throws Exception {
final String icu = "analysis-icu";
final String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/"
Expand Down