Skip to content

Fix flaky DefaultWorkerProcessBuilderIntegrationTest #34426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix flaky DefaultWorkerProcessBuilderIntegrationTest
In the past, this test asserts the test class path includes current user home. This is true on Hetzner machines, because project directory is in user home (`/home/tcagent1/work/f63322e10dd6b396`), but not true on EC2 agents, because on EC2 agents the project directory is in `/mnt/tcagent1/work/f63322e10dd6b396`.

[Example](https://ge.gradle.org/s/sncrks4ihxvey/tests/task/:core:isolatedProjectsIntegTest/details/org.gradle.process.internal.worker.DefaultWorkerProcessBuilderIntegrationTest/test%20classpath%20does%20not%20contain%20nonexistent%20entries?top-execution=1)

This PR fixes this by getting correct gradle user home in integration context.

Co-authored-by: Bo Zhang <[email protected]>
  • Loading branch information
bot-gradle and blindpirate committed Jul 29, 2025
commit a3430f0a94ba8b549de680d4f7daf51aba2fd07d
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ package org.gradle.process.internal.worker

import org.gradle.integtests.fixtures.AbstractIntegrationSpec
import org.gradle.integtests.fixtures.ToBeFixedForConfigurationCache
import org.gradle.integtests.fixtures.executer.IntegrationTestBuildContext

import static org.gradle.integtests.fixtures.ToBeFixedForConfigurationCache.Skip.INVESTIGATE

class DefaultWorkerProcessBuilderIntegrationTest extends AbstractIntegrationSpec {

@ToBeFixedForConfigurationCache(skip = INVESTIGATE)
def "test classpath does not contain nonexistent entries"() {
String integTestHomeDir = IntegrationTestBuildContext.INSTANCE.getGradleUserHomeDir().absolutePath
given:
file("src/test/java/ClasspathTest.java") << '''
file("src/test/java/ClasspathTest.java") << """
import org.junit.Test;
import static org.junit.Assert.assertTrue;
Expand All @@ -37,12 +39,12 @@ class DefaultWorkerProcessBuilderIntegrationTest extends AbstractIntegrationSpec
public void test() {
String runtimeClasspath = System.getProperty("java.class.path");
System.out.println(runtimeClasspath);
assertTrue(runtimeClasspath.contains(System.getProperty("user.home")));
assertTrue(runtimeClasspath.contains("${integTestHomeDir.replace("\\", "\\\\")}"));
assertTrue(!runtimeClasspath.contains("Non exist path"));
}
}
'''
"""
buildFile << """
plugins {
id "java-library"
Expand Down
Loading