Skip to content

Commit d58a480

Browse files
committed
Fix flaky OpenSearchTestBasePluginFuncTest (#20955)
When integTest runs with maxParallelForks > 1, all parallel test JVMs share the same default .gradle-test-kit directory. This causes a race condition in Gradle 9.4 where concurrent tests simultaneously read and write the Groovy DSL compiled script cache (cp_settings), resulting in a NoSuchFileException and UnexpectedBuildFailure. Fix by assigning each test method its own isolated TestKit directory via withTestKitDir() using a subdirectory within the already-unique TemporaryFolder. This eliminates cross-test cache contention while preserving daemon and task history reuse within the same test method (required for UP_TO_DATE assertions). Signed-off-by: Dharmesh <dharmesh.singh@uber.com>
1 parent fb5d661 commit d58a480

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

buildSrc/src/integTest/groovy/org/opensearch/gradle/fixtures/AbstractGradleFuncTest.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ abstract class AbstractGradleFuncTest extends Specification {
4545

4646
File settingsFile
4747
File buildFile
48+
File testKitDir
4849

4950
def setup() {
5051
settingsFile = testProjectDir.newFile('settings.gradle')
5152
settingsFile << "rootProject.name = 'hello-world'\n"
5253
buildFile = testProjectDir.newFile('build.gradle')
54+
testKitDir = testProjectDir.newFolder('.gradle-test-kit')
5355
}
5456

5557
GradleRunner gradleRunner(String... arguments) {
@@ -62,6 +64,7 @@ abstract class AbstractGradleFuncTest extends Specification {
6264
.withProjectDir(projectDir)
6365
.withArguments(arguments)
6466
.withPluginClasspath()
67+
.withTestKitDir(testKitDir)
6568
.forwardOutput()
6669
}
6770

0 commit comments

Comments
 (0)