build.gradle.kts 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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.13"
  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.51.0"))
  21. implementation("org.slf4j:slf4j-api")
  22. implementation("io.opentelemetry:opentelemetry-api")
  23. implementation("io.opentelemetry.proto:opentelemetry-proto")
  24. implementation("org.testcontainers:testcontainers")
  25. implementation("com.fasterxml.jackson.core:jackson-databind")
  26. implementation("com.google.protobuf:protobuf-java-util:3.21.9")
  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(":testing:armeria-shaded-for-testing", configuration = "shadow"))
  34. }
  35. tasks {
  36. test {
  37. testLogging.showStandardStreams = true
  38. // TODO investigate why smoke tests occasionally hang forever
  39. // this needs to be long enough so that smoke tests that are just running slow don"t time out
  40. timeout.set(Duration.ofMinutes(60))
  41. // We enable/disable smoke tests based on the java version requests
  42. // In addition to that we disable them on normal test task to only run when explicitly requested.
  43. enabled = enabled && gradle.startParameter.taskNames.any { it.startsWith(":smoke-tests:") }
  44. val suites = mapOf(
  45. "payara" to listOf("**/Payara*.*"),
  46. "jetty" to listOf("**/Jetty*.*"),
  47. "liberty" to listOf("**/Liberty*.*"),
  48. "tomcat" to listOf("**/Tomcat*.*"),
  49. "tomee" to listOf("**/Tomee*.*"),
  50. "websphere" to listOf("**/Websphere*.*"),
  51. "wildfly" to listOf("**/Wildfly*.*")
  52. )
  53. val smokeTestSuite: String? by project
  54. if (smokeTestSuite != null) {
  55. val suite = suites[smokeTestSuite]
  56. if (suite != null) {
  57. include(suite)
  58. } else if (smokeTestSuite == "other") {
  59. suites.values.forEach {
  60. exclude(it)
  61. }
  62. } else if (smokeTestSuite == "none") {
  63. // Exclude all tests. Running this suite will compile everything needed by smoke tests
  64. // without executing any tests.
  65. exclude("**/*")
  66. } else {
  67. throw GradleException("Unknown smoke test suite: $smokeTestSuite")
  68. }
  69. }
  70. val shadowTask = project(":javaagent").tasks.named<ShadowJar>("shadowJar").get()
  71. inputs.files(layout.files(shadowTask))
  72. .withPropertyName("javaagent")
  73. .withNormalizer(ClasspathNormalizer::class)
  74. doFirst {
  75. jvmArgs("-Dio.opentelemetry.smoketest.agent.shadowJar.path=${shadowTask.archiveFile.get()}")
  76. }
  77. }
  78. }