Browse Source

Don't start docker fixtures when resolving test runtime classpath (#91476)

We have some test runtime resources that are generated by our Docker
based test fixtures. These resources are then placed on the runtime
test classpath to be used by the test classes themselves. The problem
here is that any build that attempts to resolve the test runtime
classpath will then trigger the starting of these Docker fixtures, which
is quite expensive. Some of our precommit checks, like forbidden apis
and third-party audit tasks do this.

This commit decouples this a bit and removes the implicit dependency
replacing it with an explicit one on the test task itself. It's slightly
less idomatic Gradle, but it's a worthwhile optimization.
Mark Vieira 2 years ago
parent
commit
679b3c9f32
1 changed files with 2 additions and 4 deletions
  1. 2 4
      x-pack/qa/saml-idp-tests/build.gradle

+ 2 - 4
x-pack/qa/saml-idp-tests/build.gradle

@@ -6,7 +6,7 @@ apply plugin: 'elasticsearch.internal-java-rest-test'
 apply plugin: 'elasticsearch.test.fixtures'
 
 dependencies {
-  javaRestTestImplementation(testArtifact(project(xpackModule('core'))))
+  javaRestTestImplementation testArtifact(project(xpackModule('core')))
   javaRestTestImplementation "com.google.jimfs:jimfs:${versions.jimfs}"
   javaRestTestImplementation "com.google.guava:guava:${versions.jimfs_guava}"
 }
@@ -29,10 +29,8 @@ tasks.register("copyIdpFiles", Sync) {
   }
 }
 
-project.sourceSets.javaRestTest.output.dir(outputDir, builtBy: [copyIdpFiles])
-
 tasks.named("javaRestTest").configure {
-  dependsOn tasks.named("copyIdpFiles")
+  classpath += files(tasks.named("copyIdpFiles"))
   onlyIf { idpFixtureProject.postProcessFixture.state.skipped == false }
 }