build.gradle.kts 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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.3.6"
  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.64.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.25.3")
  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. // this needs to be long enough so that smoke tests that are just running slow don't time out
  39. timeout.set(Duration.ofMinutes(60))
  40. // We enable/disable smoke tests based on the java version requests
  41. // In addition to that we disable them on normal test task to only run when explicitly requested.
  42. enabled = enabled && gradle.startParameter.taskNames.any { it.startsWith(":smoke-tests:") }
  43. val suites = mapOf(
  44. "payara" to listOf("**/Payara*.*"),
  45. "jetty" to listOf("**/Jetty*.*"),
  46. "liberty" to listOf("**/Liberty*.*"),
  47. "tomcat" to listOf("**/Tomcat*.*"),
  48. "tomee" to listOf("**/Tomee*.*"),
  49. "websphere" to listOf("**/Websphere*.*"),
  50. "wildfly" to listOf("**/Wildfly*.*"),
  51. )
  52. val smokeTestSuite: String? by project
  53. if (smokeTestSuite != null) {
  54. val suite = suites[smokeTestSuite]
  55. if (suite != null) {
  56. include(suite)
  57. } else if (smokeTestSuite == "other") {
  58. suites.values.forEach {
  59. exclude(it)
  60. }
  61. } else if (smokeTestSuite == "none") {
  62. // Exclude all tests. Running this suite will compile everything needed by smoke tests
  63. // without executing any tests.
  64. exclude("**/*")
  65. } else {
  66. throw GradleException("Unknown smoke test suite: $smokeTestSuite")
  67. }
  68. }
  69. val shadowTask = project(":javaagent").tasks.named<ShadowJar>("shadowJar").get()
  70. inputs.files(layout.files(shadowTask))
  71. .withPropertyName("javaagent")
  72. .withNormalizer(ClasspathNormalizer::class)
  73. doFirst {
  74. jvmArgs("-Dio.opentelemetry.smoketest.agent.shadowJar.path=${shadowTask.archiveFile.get()}")
  75. }
  76. }
  77. }