build.gradle.kts 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
  2. import java.time.Duration
  3. plugins {
  4. id("otel.java-conventions")
  5. }
  6. description = "smoke-tests"
  7. otelJava {
  8. // we only need to run the Spock test itself under a single Java version, and the Spock test in
  9. // turn is parameterized and runs the test using different docker containers that run different
  10. // Java versions
  11. minJavaVersionSupported.set(JavaVersion.VERSION_11)
  12. maxJavaVersionForTests.set(JavaVersion.VERSION_11)
  13. }
  14. val dockerJavaVersion = "3.2.5"
  15. dependencies {
  16. testCompileOnly("com.google.auto.value:auto-value-annotations")
  17. testAnnotationProcessor("com.google.auto.value:auto-value")
  18. api("org.spockframework:spock-core")
  19. api(project(":testing-common"))
  20. implementation(platform("io.grpc:grpc-bom:1.33.1"))
  21. implementation("org.slf4j:slf4j-api")
  22. implementation("io.opentelemetry:opentelemetry-api")
  23. implementation("io.opentelemetry:opentelemetry-proto")
  24. implementation("org.testcontainers:testcontainers")
  25. implementation("com.fasterxml.jackson.core:jackson-databind")
  26. implementation("com.google.protobuf:protobuf-java-util:3.12.4")
  27. implementation("io.grpc:grpc-netty-shaded")
  28. implementation("io.grpc:grpc-protobuf")
  29. implementation("io.grpc:grpc-stub")
  30. testImplementation("com.github.docker-java:docker-java-core:$dockerJavaVersion")
  31. testImplementation("com.github.docker-java:docker-java-transport-httpclient5:$dockerJavaVersion")
  32. // make IntelliJ see shaded Armeria
  33. testCompileOnly(project(path = ":testing:armeria-shaded-for-testing", configuration = "shadow"))
  34. }
  35. tasks {
  36. test {
  37. inputs.files(project(":javaagent").tasks.getByName("fullJavaagentJar").outputs.files)
  38. maxParallelForks = 2
  39. testLogging.showStandardStreams = true
  40. // TODO investigate why smoke tests occasionally hang forever
  41. // this needs to be long enough so that smoke tests that are just running slow don"t time out
  42. timeout.set(Duration.ofMinutes(45))
  43. // We enable/disable smoke tests based on the java version requests
  44. // In addition to that we disable them on normal test task to only run when explicitly requested.
  45. enabled = enabled && gradle.startParameter.taskNames.any { it.startsWith(":smoke-tests:") }
  46. val suites = mapOf(
  47. "glassfish" to listOf("**/GlassFishSmokeTest.*"),
  48. "jetty" to listOf("**/JettySmokeTest.*"),
  49. "liberty" to listOf("**/LibertySmokeTest.*", "**/LibertyServletOnlySmokeTest.*"),
  50. "tomcat" to listOf("**/TomcatSmokeTest.*"),
  51. "tomee" to listOf("**/TomeeSmokeTest.*"),
  52. "wildfly" to listOf("**/WildflySmokeTest.*")
  53. )
  54. val smokeTestSuite: String? by project
  55. if (smokeTestSuite != null) {
  56. val suite = suites[smokeTestSuite]
  57. if (suite != null) {
  58. include(suite)
  59. } else if (smokeTestSuite == "other") {
  60. suites.values.forEach {
  61. exclude(it)
  62. }
  63. } else {
  64. throw GradleException("Unknown smoke test suite: $smokeTestSuite")
  65. }
  66. }
  67. val shadowTask = project(":javaagent").tasks.named<ShadowJar>("fullJavaagentJar").get()
  68. inputs.files(layout.files(shadowTask))
  69. doFirst {
  70. jvmArgs("-Dio.opentelemetry.smoketest.agent.shadowJar.path=${shadowTask.archiveFile.get()}")
  71. }
  72. }
  73. }