import java.time.Duration

ext {
  // we only need to run the Spock test itself under a single Java version, and the Spock test in
  // turn is parameterized and runs the test using different docker containers that run different
  // Java versions
  minJavaVersionForTests = JavaVersion.VERSION_11
  maxJavaVersionForTests = JavaVersion.VERSION_11
}

apply from: "$rootDir/gradle/java.gradle"

description = 'smoke-tests'

dependencies {
  api deps.spock
  api project(':testing-common')

  implementation platform("io.grpc:grpc-bom:1.33.1")
  implementation deps.slf4j
  implementation deps.opentelemetryProto
  implementation deps.opentelemetryApi
  implementation deps.testcontainers
  implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.2'
  implementation 'com.google.protobuf:protobuf-java-util:3.12.4'
  implementation 'io.grpc:grpc-netty-shaded'
  implementation 'io.grpc:grpc-protobuf'
  implementation 'io.grpc:grpc-stub'
}

test {
  inputs.files(tasks.findByPath(':javaagent:shadowJar').outputs.files)
  maxParallelForks = 2

  timeout.set(Duration.ofMinutes(30))

  //We enable/disable smoke tests based on the java version requests
  //In addition to that we disable them by default on local machines
  enabled = enabled && (System.getenv("CI") != null || findProperty('runSmokeTests'))

  doFirst {
    jvmArgs "-Dio.opentelemetry.smoketest.agent.shadowJar.path=${project(':javaagent').tasks.shadowJar.archivePath}"
  }
}
