opentelemetry-java-instrume.../smoke-tests/smoke-tests.gradle

79 lines
2.5 KiB
Groovy

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'
def dockerJavaVersion = "3.2.5"
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'
testImplementation("com.github.docker-java:docker-java-core:$dockerJavaVersion")
testImplementation("com.github.docker-java:docker-java-transport-httpclient5:$dockerJavaVersion")
}
test {
inputs.files(tasks.findByPath(':javaagent:shadowJar').outputs.files)
maxParallelForks = 2
testLogging.showStandardStreams = true
// TODO investigate why smoke tests occasionally hang forever
// this needs to be long enough so that smoke tests that are just running slow don't time out
timeout.set(Duration.ofMinutes(45))
//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'))
def suites = [
"glassfish": ["**/GlassFishSmokeTest.*"],
"jetty" : ["**/JettySmokeTest.*"],
"liberty" : ["**/LibertySmokeTest.*", "**/LibertyServletOnlySmokeTest.*"],
"tomcat" : ["**/TomcatSmokeTest.*"],
"tomee" : ["**/TomeeSmokeTest.*"],
"wildfly" : ["**/WildflySmokeTest.*"]
]
def suite = findProperty('smokeTestSuite')
if (suite != null) {
if ('other' == suite) {
suites.values().each {
exclude it
}
} else if (suites.containsKey(suite)) {
include suites.get(suite)
} else {
throw new GradleException('Unknown smoke test suite: ' + suite)
}
}
def shadowTask = project(":javaagent").tasks.named("shadowJar").get()
inputs.files(layout.files(shadowTask))
doFirst {
jvmArgs "-Dio.opentelemetry.smoketest.agent.shadowJar.path=${shadowTask.archiveFile.get()}"
}
}