Skip to content

Commit

Permalink
Fixed spotlessJavaCheck
Browse files Browse the repository at this point in the history
Signed-off-by: Abhilasha Seth <[email protected]>
  • Loading branch information
abseth-amzn committed May 18, 2023
1 parent 30be1c2 commit a5595f5
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ public void testInstallPluginDifferingInPatchVersionAllowed() throws Exception {
Tuple<Path, Environment> env = createEnv(fs, temp);
Path pluginDir = createPluginDir(temp);
Version coreVersion = Version.CURRENT;
Version pluginVersion = VersionUtils.getVersion(coreVersion.major, coreVersion.minor, (byte)(coreVersion.revision + 1));
Version pluginVersion = VersionUtils.getVersion(coreVersion.major, coreVersion.minor, (byte) (coreVersion.revision + 1));
// Plugin explicitly specifies semVer range compatibility so patch version is not checked
String pluginZip = createPlugin("fake", pluginDir, pluginVersion, "is.semVer.range.compatible", "true").toUri().toURL().toString();
skipJarHellCommand.execute(terminal, Collections.singletonList(pluginZip), false, env.v2());
Expand All @@ -891,19 +891,25 @@ public void testInstallPluginDifferingInPatchVersionNotAllowed() throws Exceptio
Tuple<Path, Environment> env = createEnv(fs, temp);
Path pluginDir = createPluginDir(temp);
Version coreVersion = Version.CURRENT;
Version pluginVersion = VersionUtils.getVersion(coreVersion.major, coreVersion.minor, (byte)(coreVersion.revision + 1));
Version pluginVersion = VersionUtils.getVersion(coreVersion.major, coreVersion.minor, (byte) (coreVersion.revision + 1));
String pluginZip = createPlugin("fake", pluginDir, pluginVersion).toUri().toURL().toString();
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> skipJarHellCommand.execute(terminal, Collections.singletonList(pluginZip), false, env.v2()));
IllegalArgumentException e = expectThrows(
IllegalArgumentException.class,
() -> skipJarHellCommand.execute(terminal, Collections.singletonList(pluginZip), false, env.v2())
);
assertThat(e.getMessage(), containsString("Plugin [fake] was built for OpenSearch version"));
}

public void testInstallPluginDifferingInMinorVersionNotAllowed() throws Exception {
Tuple<Path, Environment> env = createEnv(fs, temp);
Path pluginDir = createPluginDir(temp);
Version coreVersion = Version.CURRENT;
Version pluginVersion = VersionUtils.getVersion(coreVersion.major, (byte)(coreVersion.minor + 1), coreVersion.revision);
Version pluginVersion = VersionUtils.getVersion(coreVersion.major, (byte) (coreVersion.minor + 1), coreVersion.revision);
String pluginZip = createPlugin("fake", pluginDir, pluginVersion).toUri().toURL().toString();
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> skipJarHellCommand.execute(terminal, Collections.singletonList(pluginZip), false, env.v2()));
IllegalArgumentException e = expectThrows(
IllegalArgumentException.class,
() -> skipJarHellCommand.execute(terminal, Collections.singletonList(pluginZip), false, env.v2())
);
assertThat(e.getMessage(), containsString("Plugin [fake] was built for OpenSearch version"));
}

Expand Down

0 comments on commit a5595f5

Please sign in to comment.