Skip to content

Commit 513e475

Browse files
committed
Set es.entitlement.enableForTests for :libs:entitlement
1 parent 3ce1cb4 commit 513e475

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

libs/entitlement/build.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,16 @@ dependencies {
3636
tasks.withType(CheckForbiddenApisTask).configureEach {
3737
replaceSignatureFiles 'jdk-signatures'
3838
}
39+
40+
project.getTasks().withType(Test.class).configureEach(test -> {
41+
// This is an exception to our usual rule about which tests have entitlements enabled.
42+
// For most subprojects, we enable entitlements for tests if and only if the
43+
// test-build-info plugin is applied, because those are precisely the subprojects
44+
// that need entitlement enforcement in production, so their tests should also have enforcement.
45+
// This subproject's tests are different: they are keenly aware of entitlements,
46+
// and can configure entitlements however they need on a case-by-case basis
47+
// in a manner that would be unduly burdensome for all our other tests.
48+
if (List.of("test", "internalClusterTest").contains(test.getName())) {
49+
test.systemProperty("es.entitlement.enableForTests", "true");
50+
}
51+
});

0 commit comments

Comments
 (0)