Skip to content

Commit 26baece

Browse files
committed
Pass testOnlyPath in environment instead of command line.
It's typically a very very long string, which made Windows angry.
1 parent 2381c88 commit 26baece

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchTestBasePlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.gradle.api.artifacts.ConfigurationContainer;
2828
import org.gradle.api.file.FileCollection;
2929
import org.gradle.api.plugins.JavaPlugin;
30+
import org.gradle.api.provider.Provider;
3031
import org.gradle.api.provider.ProviderFactory;
3132
import org.gradle.api.tasks.SourceSet;
3233
import org.gradle.api.tasks.SourceSetContainer;
@@ -182,7 +183,7 @@ public void execute(Task t) {
182183
FileCollection mainRuntime = mainSourceSet.getRuntimeClasspath();
183184
FileCollection testRuntime = testSourceSet.getRuntimeClasspath();
184185
FileCollection testOnlyFiles = testRuntime.minus(mainRuntime);
185-
nonInputProperties.systemProperty("es.entitlement.testOnlyPath", testOnlyFiles::getAsPath);
186+
test.environment("es.entitlement.testOnlyPath", project.provider(testOnlyFiles::getAsPath));
186187
}
187188

188189
test.systemProperties(getProviderFactory().systemPropertiesPrefixedBy("tests.").get());

test/framework/src/main/java/org/elasticsearch/entitlement/bootstrap/TestEntitlementBootstrap.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ private static TestPolicyManager createPolicyManager(PathLookup pathLookup) thro
122122

123123
FilesEntitlementsValidation.validate(pluginPolicies, pathLookup);
124124

125-
String testOnlyPathProperty = System.getProperty("es.entitlement.testOnlyPath");
125+
String testOnlyPathString = System.getenv("es.entitlement.testOnlyPath");
126126
Set<String> testOnlyClassPath;
127-
if (testOnlyPathProperty == null) {
127+
if (testOnlyPathString == null) {
128128
testOnlyClassPath = Set.of();
129129
} else {
130-
testOnlyClassPath = Arrays.stream(testOnlyPathProperty.split(":")).collect(toCollection(TreeSet::new));
130+
testOnlyClassPath = Arrays.stream(testOnlyPathString.split(":")).collect(toCollection(TreeSet::new));
131131
}
132132

133133
return new TestPolicyManager(

0 commit comments

Comments
 (0)