Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 42 additions & 27 deletions runtime-attach/runtime-attach/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,48 @@ dependencies {
testImplementation("org.assertj:assertj-core")
}

testing {
suites {
val test by getting(JvmTestSuite::class) {
targets.all {
testTask.configure {
setForkEvery(1) // One JVM by test class to avoid a test class launching a runtime attachment influences the behavior of another test class
filter {
excludeTestsMatching("AgentDisabledByEnvironmentVariableTest")
excludeTestsMatching("AgentDisabledBySystemPropertyTest")
}
}
}
}

val testAgentDisabledByEnvironmentVariable by registering(JvmTestSuite::class) {
targets.all {
testTask.configure {
setForkEvery(1)
filter {
includeTestsMatching("AgentDisabledByEnvironmentVariableTest")
}
include("**/AgentDisabledByEnvironmentVariableTest.*")
environment("OTEL_JAVAAGENT_ENABLED", "false")
}
}
}

val testAgentDisabledBySystemProperty by registering(JvmTestSuite::class) {
targets.all {
testTask.configure {
setForkEvery(1)
filter {
includeTestsMatching("AgentDisabledBySystemPropertyTest")
}
include("**/AgentDisabledBySystemPropertyTest.*")
jvmArgs("-Dotel.javaagent.enabled=false")
}
}
}
}
}

tasks {
jar {
inputs.files(agent)
Expand All @@ -32,31 +74,4 @@ tasks {
})
rename("^(.*)\\.jar\$", "otel-agent.jar")
}

withType<Test>().configureEach {
setForkEvery(1) // One JVM by test class to avoid a test class launching a runtime attachment influences the behavior of another test class
}

val testAgentDisabledByEnvironmentVariable by registering(Test::class) {
filter {
includeTestsMatching("AgentDisabledByEnvironmentVariableTest")
}
include("**/AgentDisabledByEnvironmentVariableTest.*")
environment("OTEL_JAVAAGENT_ENABLED", "false")
}

val testAgentDisabledBySystemProperty by registering(Test::class) {
filter {
includeTestsMatching("AgentDisabledBySystemPropertyTest")
}
include("**/AgentDisabledBySystemPropertyTest.*")
jvmArgs("-Dotel.javaagent.enabled=false")
}

test {
filter {
excludeTestsMatching("AgentDisabledByEnvironmentVariableTest")
excludeTestsMatching("AgentDisabledBySystemPropertyTest")
}
}
}