Browse Source

Convert vaadin tests to test suites (#7944)

Part of
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/7911
Lauri Tulmin 2 years ago
parent
commit
8c1b072682
1 changed files with 49 additions and 48 deletions
  1. 49 48
      instrumentation/vaadin-14.2/javaagent/build.gradle.kts

+ 49 - 48
instrumentation/vaadin-14.2/javaagent/build.gradle.kts

@@ -1,6 +1,5 @@
 plugins {
   id("otel.javaagent-instrumentation")
-  id("org.unbroken-dome.test-sets")
 }
 
 muzzle {
@@ -26,30 +25,6 @@ muzzle {
   }
 }
 
-testSets {
-  create("vaadin142Test")
-  create("vaadin14LatestTest")
-  create("vaadin16Test")
-  create("latestDepTest") {
-    dirName = "vaadinLatestTest"
-  }
-}
-
-tasks {
-  val vaadin142Test by existing
-  val vaadin16Test by existing
-  val vaadin14LatestTest by existing
-
-  test {
-    dependsOn(vaadin142Test)
-    dependsOn(vaadin16Test)
-    if (findProperty("testLatestDeps") as Boolean) {
-      dependsOn(vaadin14LatestTest)
-    }
-    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service)
-  }
-}
-
 dependencies {
   compileOnly("com.google.auto.value:auto-value-annotations")
   annotationProcessor("com.google.auto.value:auto-value")
@@ -58,34 +33,60 @@ dependencies {
 
   compileOnly("com.vaadin:flow-server:2.2.0")
 
-  add("vaadin16TestImplementation", "com.vaadin:vaadin-spring-boot-starter:16.0.0")
-  add("vaadin142TestImplementation", "com.vaadin:vaadin-spring-boot-starter:14.2.0")
-
-  testImplementation(project(":instrumentation:vaadin-14.2:testing"))
-
   testInstrumentation(project(":instrumentation:servlet:servlet-3.0:javaagent"))
   testInstrumentation(project(":instrumentation:servlet:servlet-javax-common:javaagent"))
   testInstrumentation(project(":instrumentation:tomcat:tomcat-7.0:javaagent"))
-
-  add("vaadin14LatestTestImplementation", "com.vaadin:vaadin-spring-boot-starter:14.+")
-  add("latestDepTestImplementation", "com.vaadin:vaadin-spring-boot-starter:+")
 }
 
-configurations {
-  listOf(
-    testRuntimeClasspath,
-    named("vaadin142TestRuntimeClasspath"),
-    named("vaadin14LatestTestRuntimeClasspath"),
-    named("vaadin16TestRuntimeClasspath"),
-    named("latestDepTestRuntimeClasspath"),
-  )
-    .forEach {
-      it.configure {
-        resolutionStrategy {
-          // requires old logback (and therefore also old slf4j)
-          force("ch.qos.logback:logback-classic:1.2.11")
-          force("org.slf4j:slf4j-api:1.7.36")
-        }
+testing {
+  suites {
+    val vaadin142Test by registering(JvmTestSuite::class) {
+      dependencies {
+        implementation(project(":instrumentation:vaadin-14.2:testing"))
+        implementation("com.vaadin:vaadin-spring-boot-starter:14.2.0")
       }
     }
+
+    val vaadin16Test by registering(JvmTestSuite::class) {
+      dependencies {
+        implementation(project(":instrumentation:vaadin-14.2:testing"))
+        implementation("com.vaadin:vaadin-spring-boot-starter:16.0.0")
+      }
+    }
+
+    val vaadin14LatestTest by registering(JvmTestSuite::class) {
+      dependencies {
+        implementation(project(":instrumentation:vaadin-14.2:testing"))
+        implementation("com.vaadin:vaadin-spring-boot-starter:14.+")
+      }
+    }
+
+    val vaadinLatestTest by registering(JvmTestSuite::class) {
+      dependencies {
+        implementation(project(":instrumentation:vaadin-14.2:testing"))
+        implementation("com.vaadin:vaadin-spring-boot-starter:+")
+      }
+    }
+  }
+}
+
+tasks {
+  withType<Test>().configureEach {
+    usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service)
+  }
+
+  check {
+    if (findProperty("testLatestDeps") as Boolean) {
+      dependsOn(testing.suites.named("vaadin14LatestTest"), testing.suites.named("vaadinLatestTest"))
+    } else {
+      dependsOn(testing.suites.named("vaadin142Test"), testing.suites.named("vaadin16Test"))
+    }
+  }
+}
+configurations.configureEach {
+  resolutionStrategy {
+    // requires old logback (and therefore also old slf4j)
+    force("ch.qos.logback:logback-classic:1.2.11")
+    force("org.slf4j:slf4j-api:1.7.36")
+  }
 }