diff --git a/qa/entitlements/build.gradle b/qa/entitlements/build.gradle index 2621d2731f41..9a5058a3b11a 100644 --- a/qa/entitlements/build.gradle +++ b/qa/entitlements/build.gradle @@ -18,21 +18,8 @@ esplugin { classname 'org.elasticsearch.test.entitlements.EntitlementsCheckPlugin' } -configurations { - entitlementBridge { - canBeConsumed = false - } -} - dependencies { clusterPlugins project(':qa:entitlements') - entitlementBridge project(':libs:entitlement:bridge') -} - -tasks.named('javaRestTest') { - systemProperty "tests.entitlement-bridge.jar-name", configurations.entitlementBridge.singleFile.getName() - usesDefaultDistribution() - systemProperty "tests.security.manager", "false" } tasks.named("javadoc").configure { diff --git a/qa/entitlements/src/javaRestTest/java/org/elasticsearch/test/entitlements/EntitlementsIT.java b/qa/entitlements/src/javaRestTest/java/org/elasticsearch/test/entitlements/EntitlementsIT.java index a62add89c51e..8b3629527f91 100644 --- a/qa/entitlements/src/javaRestTest/java/org/elasticsearch/test/entitlements/EntitlementsIT.java +++ b/qa/entitlements/src/javaRestTest/java/org/elasticsearch/test/entitlements/EntitlementsIT.java @@ -10,9 +10,7 @@ package org.elasticsearch.test.entitlements; import org.elasticsearch.client.Request; -import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.cluster.ElasticsearchCluster; -import org.elasticsearch.test.cluster.local.distribution.DistributionType; import org.elasticsearch.test.rest.ESRestTestCase; import org.junit.ClassRule; @@ -20,21 +18,13 @@ import static org.hamcrest.Matchers.containsString; -@ESTestCase.WithoutSecurityManager public class EntitlementsIT extends ESRestTestCase { - private static final String ENTITLEMENT_BRIDGE_JAR_NAME = System.getProperty("tests.entitlement-bridge.jar-name"); - @ClassRule public static ElasticsearchCluster cluster = ElasticsearchCluster.local() - .distribution(DistributionType.INTEG_TEST) .plugin("entitlement-qa") .systemProperty("es.entitlements.enabled", "true") .setting("xpack.security.enabled", "false") - .jvmArg("-Djdk.attach.allowAttachSelf=true") - .jvmArg("-XX:+EnableDynamicAgentLoading") - .jvmArg("--patch-module=java.base=lib/entitlement-bridge/" + ENTITLEMENT_BRIDGE_JAR_NAME) - .jvmArg("--add-exports=java.base/org.elasticsearch.entitlement.bridge=org.elasticsearch.entitlement") .build(); @Override diff --git a/test/test-clusters/src/main/java/org/elasticsearch/test/cluster/local/AbstractLocalClusterFactory.java b/test/test-clusters/src/main/java/org/elasticsearch/test/cluster/local/AbstractLocalClusterFactory.java index ec1bf13bd993..717cf96ad6a9 100644 --- a/test/test-clusters/src/main/java/org/elasticsearch/test/cluster/local/AbstractLocalClusterFactory.java +++ b/test/test-clusters/src/main/java/org/elasticsearch/test/cluster/local/AbstractLocalClusterFactory.java @@ -59,6 +59,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import static java.util.function.Predicate.not; import static org.elasticsearch.test.cluster.local.distribution.DistributionType.DEFAULT; import static org.elasticsearch.test.cluster.util.OS.WINDOWS; @@ -755,18 +756,16 @@ private Map getEnvironmentVariables() { } String heapSize = System.getProperty("tests.heap.size", "512m"); - final String esJavaOpts = Stream.of( - "-Xms" + heapSize, - "-Xmx" + heapSize, - "-ea", - "-esa", - System.getProperty("tests.jvm.argline", ""), - featureFlagProperties, - systemProperties, - jvmArgs, - debugArgs - ).filter(s -> s.isEmpty() == false).collect(Collectors.joining(" ")); + List serverOpts = List.of("-Xms" + heapSize, "-Xmx" + heapSize, debugArgs, featureFlagProperties); + List commonOpts = List.of("-ea", "-esa", System.getProperty("tests.jvm.argline", ""), systemProperties, jvmArgs); + + String esJavaOpts = Stream.concat(serverOpts.stream(), commonOpts.stream()) + .filter(not(String::isEmpty)) + .collect(Collectors.joining(" ")); + String cliJavaOpts = commonOpts.stream().filter(not(String::isEmpty)).collect(Collectors.joining(" ")); + environment.put("ES_JAVA_OPTS", esJavaOpts); + environment.put("CLI_JAVA_OPTS", cliJavaOpts); return environment; }