Skip to content

Commit

Permalink
Fix issue when installing multiple test cluster plugins (elastic#105516)
Browse files Browse the repository at this point in the history
# Conflicts:
#	x-pack/plugin/ml/qa/ml-inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/InferenceBaseRestTest.java
  • Loading branch information
mark-vieira committed Feb 14, 2024
1 parent c292d7b commit be361d3
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ public synchronized void start(Version version) {
createConfigDirectory();
copyExtraConfigFiles(); // extra config files might be needed for running cli tools like plugin install
copyExtraJarFiles();
installPlugins();
if (distributionDescriptor.getType() == DistributionType.INTEG_TEST) {
installModules();
}
installPlugins();
currentVersion = spec.getVersion();
} else {
createConfigDirectory();
Expand Down Expand Up @@ -591,7 +591,7 @@ private void configureSecurity() {

private void installPlugins() {
if (spec.getPlugins().isEmpty() == false) {
Pattern pattern = Pattern.compile("(.+)(?:-\\d\\.\\d\\.\\d-SNAPSHOT\\.zip)?");
Pattern pattern = Pattern.compile("(.+)(?:-\\d+\\.\\d+\\.\\d+(-SNAPSHOT)?\\.zip)");

LOGGER.info("Installing plugins {} into node '{}", spec.getPlugins(), name);
List<Path> pluginPaths = Arrays.stream(System.getProperty(TESTS_CLUSTER_PLUGINS_PATH_SYSPROP).split(File.pathSeparator))
Expand All @@ -603,8 +603,8 @@ private void installPlugins() {
.map(
pluginName -> pluginPaths.stream()
.map(path -> Pair.of(pattern.matcher(path.getFileName().toString()), path))
.filter(pair -> pair.left.matches())
.map(p -> p.right.getParent().resolve(p.left.group(1)))
.filter(pair -> pair.left.matches() && pair.left.group(1).equals(pluginName))
.map(p -> p.right.getParent().resolve(p.left.group(0)))
.findFirst()
.orElseThrow(() -> {
String taskPath = System.getProperty("tests.task");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class InferenceBaseRestTest extends ESRestTestCase {
.distribution(DistributionType.DEFAULT)
.setting("xpack.license.self_generated.type", "trial")
.setting("xpack.security.enabled", "true")
.plugin("org.elasticsearch.xpack.inference.mock.TestInferenceServicePlugin")
.plugin("inference-service-test")
.user("x_pack_rest_user", "x-pack-test-password")
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class OperatorPrivilegesIT extends ESRestTestCase {
.setting("xpack.security.http.ssl.enabled", "false")
.setting("xpack.security.operator_privileges.enabled", "true")
.setting("path.repo", () -> repoDirectory.getRoot().getPath())
.plugin("org.elasticsearch.xpack.security.operator.OperatorPrivilegesTestPlugin")
.plugin("operator-privileges-test")
.rolesFile(Resource.fromClasspath("roles.yml"))
.configFile("service_tokens", Resource.fromClasspath("service_tokens"))
.configFile("operator_users.yml", Resource.fromClasspath("operator_users.yml"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private static ElasticsearchCluster clusterSettings(String remoteAddress) {
.setting("xpack.license.self_generated.type", "trial")
.setting("xpack.security.autoconfiguration.enabled", "false")
.user(USER_NAME, PASSWORD)
.plugin(":x-pack:qa:freeze-plugin")
.plugin("freeze-plugin")
.build();
}

Expand All @@ -58,7 +58,7 @@ private static ElasticsearchCluster remoteClusterSettings() {
.setting("xpack.license.self_generated.type", "trial")
.setting("xpack.security.autoconfiguration.enabled", "false")
.user(USER_NAME, PASSWORD)
.plugin(":x-pack:qa:freeze-plugin")
.plugin("freeze-plugin")
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static ElasticsearchCluster getCluster() {
.setting("xpack.watcher.enabled", "false")
.setting("xpack.security.enabled", "false")
.setting("xpack.license.self_generated.type", "trial")
.plugin(":x-pack:qa:freeze-plugin")
.plugin("freeze-plugin")
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static ElasticsearchCluster getCluster(boolean enableFreezing) {
.setting("xpack.license.self_generated.type", "trial");

if (enableFreezing) {
settings = settings.plugin(":x-pack:qa:freeze-plugin");
settings = settings.plugin("freeze-plugin");
}

return settings.build();
Expand Down

0 comments on commit be361d3

Please sign in to comment.