Browse Source

Limit number of concurrently running docker tests (#3664)

* Limit number of concurrently running docker tests

* rename heavy to testcontainers

* use shorter expression
Lauri Tulmin 3 years ago
parent
commit
ff5472a822
30 changed files with 125 additions and 0 deletions
  1. 15 0
      buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts
  2. 6 0
      instrumentation/cassandra/cassandra-3.0/javaagent/build.gradle.kts
  3. 6 0
      instrumentation/cassandra/cassandra-4.0/javaagent/build.gradle.kts
  4. 6 0
      instrumentation/couchbase/couchbase-3.1.6/javaagent/build.gradle.kts
  5. 6 0
      instrumentation/couchbase/couchbase-3.1/javaagent/build.gradle.kts
  6. 6 0
      instrumentation/couchbase/couchbase-3.2/javaagent/build.gradle.kts
  7. 1 0
      instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/build.gradle.kts
  8. 6 0
      instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagent/build.gradle.kts
  9. 6 0
      instrumentation/elasticsearch/elasticsearch-rest-7.0/javaagent/build.gradle.kts
  10. 2 0
      instrumentation/gwt-2.0/javaagent/build.gradle.kts
  11. 6 0
      instrumentation/jedis/jedis-1.4/javaagent/build.gradle.kts
  12. 6 0
      instrumentation/jedis/jedis-3.0/javaagent/build.gradle.kts
  13. 1 0
      instrumentation/jms-1.1/javaagent/build.gradle.kts
  14. 1 0
      instrumentation/lettuce/lettuce-4.0/javaagent/build.gradle.kts
  15. 1 0
      instrumentation/lettuce/lettuce-5.0/javaagent/build.gradle.kts
  16. 1 0
      instrumentation/lettuce/lettuce-5.1/javaagent/build.gradle.kts
  17. 1 0
      instrumentation/lettuce/lettuce-5.1/library/build.gradle.kts
  18. 6 0
      instrumentation/mongo/mongo-3.1/javaagent/build.gradle.kts
  19. 6 0
      instrumentation/mongo/mongo-3.1/library/build.gradle.kts
  20. 6 0
      instrumentation/mongo/mongo-3.7/javaagent/build.gradle.kts
  21. 6 0
      instrumentation/mongo/mongo-4.0/javaagent/build.gradle.kts
  22. 6 0
      instrumentation/mongo/mongo-async-3.3/javaagent/build.gradle.kts
  23. 1 0
      instrumentation/rabbitmq-2.7/javaagent/build.gradle.kts
  24. 6 0
      instrumentation/rediscala-1.8/javaagent/build.gradle.kts
  25. 1 0
      instrumentation/redisson-3.0/javaagent/build.gradle.kts
  26. 1 0
      instrumentation/spring/spring-integration-4.1/javaagent/build.gradle.kts
  27. 1 0
      instrumentation/spring/spring-integration-4.1/library/build.gradle.kts
  28. 6 0
      instrumentation/spring/spring-rabbit-1.0/javaagent/build.gradle.kts
  29. 1 0
      instrumentation/spymemcached-2.12/javaagent/build.gradle.kts
  30. 1 0
      instrumentation/vaadin-14.2/javaagent/build.gradle.kts

+ 15 - 0
buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts

@@ -172,6 +172,21 @@ fun isJavaVersionAllowed(version: JavaVersion): Boolean {
   return true
 }
 
+class TestcontainersBuildService : BuildService<BuildServiceParameters.None?> {
+  override fun getParameters(): BuildServiceParameters.None? {
+    return null
+  }
+}
+// To limit number of concurrently running resource intensive tests add
+// tasks {
+//   named<Test>("test") {
+//     usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
+//   }
+// }
+gradle.sharedServices.registerIfAbsent("testcontainersBuildService", TestcontainersBuildService::class.java) {
+  maxParallelUsages.convention(2)
+}
+
 val testJavaVersion = gradle.startParameter.projectProperties.get("testJavaVersion")?.let(JavaVersion::toVersion)
 val resourceClassesCsv = listOf("Host", "Os", "Process", "ProcessRuntime").map { "io.opentelemetry.sdk.extension.resources.${it}ResourceProvider" }.joinToString(",")
 tasks.withType<Test>().configureEach {

+ 6 - 0
instrumentation/cassandra/cassandra-3.0/javaagent/build.gradle.kts

@@ -39,3 +39,9 @@ dependencies {
 
 // Requires old Guava. Can't use enforcedPlatform since predates BOM
 configurations.testRuntimeClasspath.resolutionStrategy.force("com.google.guava:guava:19.0")
+
+tasks {
+  named<Test>("test") {
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
+  }
+}

+ 6 - 0
instrumentation/cassandra/cassandra-4.0/javaagent/build.gradle.kts

@@ -19,3 +19,9 @@ dependencies {
 
   latestDepTestLibrary("com.datastax.oss:java-driver-core:4.+")
 }
+
+tasks {
+  named<Test>("test") {
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
+  }
+}

+ 6 - 0
instrumentation/couchbase/couchbase-3.1.6/javaagent/build.gradle.kts

@@ -26,4 +26,10 @@ dependencies {
 
   latestDepTestLibrary("com.couchbase.client:java-client:3.1.6")
   latestDepTestLibrary("com.couchbase.client:core-io:2.1.6")
+}
+
+tasks {
+  named<Test>("test") {
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
+  }
 }

+ 6 - 0
instrumentation/couchbase/couchbase-3.1/javaagent/build.gradle.kts

@@ -26,4 +26,10 @@ dependencies {
 
   latestDepTestLibrary("com.couchbase.client:java-client:3.1.5")
   latestDepTestLibrary("com.couchbase.client:core-io:2.1.5")
+}
+
+tasks {
+  named<Test>("test") {
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
+  }
 }

+ 6 - 0
instrumentation/couchbase/couchbase-3.2/javaagent/build.gradle.kts

@@ -23,4 +23,10 @@ dependencies {
   testLibrary("com.couchbase.client:java-client:3.2.0")
 
   testImplementation("org.testcontainers:couchbase:${versions["org.testcontainers"]}")
+}
+
+tasks {
+  named<Test>("test") {
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
+  }
 }

+ 1 - 0
instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/build.gradle.kts

@@ -40,5 +40,6 @@ dependencies {
 tasks {
   withType<Test>().configureEach {
     systemProperty("testLatestDeps", findProperty("testLatestDeps"))
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
   }
 }

+ 6 - 0
instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagent/build.gradle.kts

@@ -38,3 +38,9 @@ dependencies {
 
   latestDepTestLibrary("org.elasticsearch.client:elasticsearch-rest-client:6.+")
 }
+
+tasks {
+  named<Test>("test") {
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
+  }
+}

+ 6 - 0
instrumentation/elasticsearch/elasticsearch-rest-7.0/javaagent/build.gradle.kts

@@ -35,3 +35,9 @@ dependencies {
 
   testImplementation("org.testcontainers:elasticsearch:${versions["org.testcontainers"]}")
 }
+
+tasks {
+  named<Test>("test") {
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
+  }
+}

+ 2 - 0
instrumentation/gwt-2.0/javaagent/build.gradle.kts

@@ -96,5 +96,7 @@ tasks {
 
     // add test app classes to classpath
     classpath = sourceSets.test.get().runtimeClasspath.plus(files("$buildDir/testapp/classes"))
+
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
   }
 }

+ 6 - 0
instrumentation/jedis/jedis-1.4/javaagent/build.gradle.kts

@@ -20,3 +20,9 @@ dependencies {
   // Jedis 3.0 has API changes that prevent instrumentation from applying
   latestDepTestLibrary("redis.clients:jedis:2.+")
 }
+
+tasks {
+  named<Test>("test") {
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
+  }
+}

+ 6 - 0
instrumentation/jedis/jedis-3.0/javaagent/build.gradle.kts

@@ -30,3 +30,9 @@ dependencies {
 
   testLibrary("redis.clients:jedis:3.+")
 }
+
+tasks {
+  named<Test>("test") {
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
+  }
+}

+ 1 - 0
instrumentation/jms-1.1/javaagent/build.gradle.kts

@@ -31,6 +31,7 @@ tasks {
 
   named<Test>("test") {
     dependsOn(jms2Test)
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
   }
 }
 

+ 1 - 0
instrumentation/lettuce/lettuce-4.0/javaagent/build.gradle.kts

@@ -21,4 +21,5 @@ dependencies {
 tasks.withType<Test>().configureEach {
   // TODO run tests both with and without experimental span attributes
   jvmArgs("-Dotel.instrumentation.lettuce.experimental-span-attributes=true")
+  usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
 }

+ 1 - 0
instrumentation/lettuce/lettuce-5.0/javaagent/build.gradle.kts

@@ -23,4 +23,5 @@ dependencies {
 tasks.withType<Test>().configureEach {
   // TODO run tests both with and without experimental span attributes
   jvmArgs("-Dotel.instrumentation.lettuce.experimental-span-attributes=true")
+  usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
 }

+ 1 - 0
instrumentation/lettuce/lettuce-5.1/javaagent/build.gradle.kts

@@ -26,5 +26,6 @@ dependencies {
 tasks {
   named<Test>("test") {
     systemProperty("testLatestDeps", findProperty("testLatestDeps"))
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
   }
 }

+ 1 - 0
instrumentation/lettuce/lettuce-5.1/library/build.gradle.kts

@@ -15,5 +15,6 @@ dependencies {
 tasks {
   named<Test>("test") {
     systemProperty("testLatestDeps", findProperty("testLatestDeps"))
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
   }
 }

+ 6 - 0
instrumentation/mongo/mongo-3.1/javaagent/build.gradle.kts

@@ -18,3 +18,9 @@ dependencies {
 
   testImplementation(project(":instrumentation:mongo:mongo-3.1:testing"))
 }
+
+tasks {
+  named<Test>("test") {
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
+  }
+}

+ 6 - 0
instrumentation/mongo/mongo-3.1/library/build.gradle.kts

@@ -7,4 +7,10 @@ dependencies {
   library("org.mongodb:mongo-java-driver:3.1.0")
 
   testImplementation(project(":instrumentation:mongo:mongo-3.1:testing"))
+}
+
+tasks {
+  named<Test>("test") {
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
+  }
 }

+ 6 - 0
instrumentation/mongo/mongo-3.7/javaagent/build.gradle.kts

@@ -28,3 +28,9 @@ dependencies {
 
   testImplementation(project(":instrumentation:mongo:mongo-testing"))
 }
+
+tasks {
+  named<Test>("test") {
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
+  }
+}

+ 6 - 0
instrumentation/mongo/mongo-4.0/javaagent/build.gradle.kts

@@ -22,3 +22,9 @@ dependencies {
   testImplementation(project(":instrumentation:mongo:mongo-testing"))
   testImplementation("de.flapdoodle.embed:de.flapdoodle.embed.mongo:1.50.5")
 }
+
+tasks {
+  named<Test>("test") {
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
+  }
+}

+ 6 - 0
instrumentation/mongo/mongo-async-3.3/javaagent/build.gradle.kts

@@ -21,3 +21,9 @@ dependencies {
 
   testInstrumentation(project(":instrumentation:mongo:mongo-3.7:javaagent"))
 }
+
+tasks {
+  named<Test>("test") {
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
+  }
+}

+ 1 - 0
instrumentation/rabbitmq-2.7/javaagent/build.gradle.kts

@@ -26,4 +26,5 @@ dependencies {
 tasks.withType<Test>().configureEach {
   // TODO run tests both with and without experimental span attributes
   jvmArgs("-Dotel.instrumentation.rabbitmq.experimental-span-attributes=true")
+  usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
 }

+ 6 - 0
instrumentation/rediscala-1.8/javaagent/build.gradle.kts

@@ -49,3 +49,9 @@ muzzle {
 dependencies {
   library("com.github.etaty:rediscala_2.11:1.8.0")
 }
+
+tasks {
+  named<Test>("test") {
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
+  }
+}

+ 1 - 0
instrumentation/redisson-3.0/javaagent/build.gradle.kts

@@ -19,4 +19,5 @@ dependencies {
 
 tasks.named<Test>("test") {
   systemProperty("testLatestDeps", findProperty("testLatestDeps"))
+  usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
 }

+ 1 - 0
instrumentation/spring/spring-integration-4.1/javaagent/build.gradle.kts

@@ -56,5 +56,6 @@ tasks {
 
   withType<Test>().configureEach {
     systemProperty("testLatestDeps", findProperty("testLatestDeps"))
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
   }
 }

+ 1 - 0
instrumentation/spring/spring-integration-4.1/library/build.gradle.kts

@@ -19,5 +19,6 @@ dependencies {
 tasks {
   named<Test>("test") {
     systemProperty("testLatestDeps", findProperty("testLatestDeps"))
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
   }
 }

+ 6 - 0
instrumentation/spring/spring-rabbit-1.0/javaagent/build.gradle.kts

@@ -22,3 +22,9 @@ dependencies {
   testLibrary("org.springframework.boot:spring-boot-starter-test:1.5.22.RELEASE")
   testLibrary("org.springframework.boot:spring-boot-starter:1.5.22.RELEASE")
 }
+
+tasks {
+  named<Test>("test") {
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
+  }
+}

+ 1 - 0
instrumentation/spymemcached-2.12/javaagent/build.gradle.kts

@@ -20,4 +20,5 @@ dependencies {
 tasks.withType<Test>().configureEach {
   // TODO run tests both with and without experimental span attributes
   jvmArgs("-Dotel.instrumentation.spymemcached.experimental-span-attributes=true")
+  usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
 }

+ 1 - 0
instrumentation/vaadin-14.2/javaagent/build.gradle.kts

@@ -47,6 +47,7 @@ tasks {
     if (findProperty("testLatestDeps") as Boolean) {
       dependsOn(vaadin14LatestTest)
     }
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].getService())
   }
 }