Avoid clobbering shared testcluster JAR files when installing modules (#42879)

(cherry picked from commit 6da9aa29170c840bba08637c106c85bf16359979)
This commit is contained in:
Mark Vieira 2019-06-04 17:53:24 -07:00
parent 78be3dde25
commit be23658114
No known key found for this signature in database
GPG Key ID: CA947EF7E6D4B105
1 changed files with 4 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import org.elasticsearch.gradle.Distribution;
import org.elasticsearch.gradle.FileSupplier; import org.elasticsearch.gradle.FileSupplier;
import org.elasticsearch.gradle.OS; import org.elasticsearch.gradle.OS;
import org.elasticsearch.gradle.Version; import org.elasticsearch.gradle.Version;
import org.gradle.api.file.DuplicatesStrategy;
import org.gradle.api.logging.Logger; import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging; import org.gradle.api.logging.Logging;
@ -361,6 +362,9 @@ public class ElasticsearchNode implements TestClusterConfiguration {
private void installModules() { private void installModules() {
if (distribution == Distribution.INTEG_TEST) { if (distribution == Distribution.INTEG_TEST) {
modules.forEach(module -> services.copy(spec -> { modules.forEach(module -> services.copy(spec -> {
// ensure we don't override any existing JARs, since these are hardlinks other clusters might be using those files
spec.setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE);
if (module.getName().toLowerCase().endsWith(".zip")) { if (module.getName().toLowerCase().endsWith(".zip")) {
spec.from(services.zipTree(module)); spec.from(services.zipTree(module));
} else if (module.isDirectory()) { } else if (module.isDirectory()) {