Skip to content

Commit 713d874

Browse files
authored
Enable entitlements for serverless tests (#131501)
1 parent 650ce32 commit 713d874

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

build-tools/src/main/java/org/elasticsearch/gradle/test/TestBuildInfoPlugin.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,9 @@ public void apply(Project project) {
5757
task.into("META-INF", copy -> copy.from(testBuildInfoTask));
5858
});
5959

60-
if (project.getRootProject().getName().equals("elasticsearch")) {
61-
project.getTasks()
62-
.withType(Test.class)
63-
.matching(test -> List.of("test", "internalClusterTest").contains(test.getName()))
64-
.configureEach(test -> {
65-
test.systemProperty("es.entitlement.enableForTests", "true");
66-
});
67-
}
60+
project.getTasks()
61+
.withType(Test.class)
62+
.matching(test -> List.of("test", "internalClusterTest").contains(test.getName()))
63+
.configureEach(test -> test.getSystemProperties().putIfAbsent("es.entitlement.enableForTests", "true"));
6864
}
6965
}

plugins/examples/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ subprojects {
2020
targetCompatibility = 21
2121
}
2222

23+
test {
24+
// testing with entitlements doesn't work for example plugins ES-12453
25+
systemProperty 'es.entitlement.enableForTests', 'false'
26+
}
27+
2328
repositories {
2429
// Only necessary when building plugins against SNAPSHOT versions of Elasticsearch
2530
if (gradle.includedBuilds.isEmpty()) {

0 commit comments

Comments
 (0)