Skip to content

Commit

Permalink
Migrate most testsets to test suites. (#3953)
Browse files Browse the repository at this point in the history
  • Loading branch information
anuraaga authored Dec 6, 2021
1 parent d059dcd commit 8e04fbf
Show file tree
Hide file tree
Showing 9 changed files with 339 additions and 210 deletions.
2 changes: 1 addition & 1 deletion context/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ testing {
}

tasks {
named("check") {
check {
dependsOn(testing.suites)
}
}
47 changes: 29 additions & 18 deletions exporters/otlp/logs/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,51 @@ plugins {
id("otel.publish-conventions")

id("otel.animalsniffer-conventions")

id("org.unbroken-dome.test-sets")
}

description = "OpenTelemetry Protocol Trace Exporter"
otelJava.moduleName.set("io.opentelemetry.exporter.otlp.trace")

testSets {
create("testGrpcNetty")
create("testGrpcNettyShaded")
create("testGrpcOkhttp")
}

dependencies {
api(project(":sdk:logs"))
api(project(":exporters:otlp:common"))

compileOnly("io.grpc:grpc-stub")

testImplementation(project(":exporters:otlp:testing-internal"))
testImplementation(project(":sdk:testing"))

add("testGrpcNettyRuntimeOnly", "io.grpc:grpc-netty")
add("testGrpcNettyRuntimeOnly", "io.grpc:grpc-stub")

add("testGrpcNettyShadedRuntimeOnly", "io.grpc:grpc-netty-shaded")
add("testGrpcNettyShadedRuntimeOnly", "io.grpc:grpc-stub")
}

add("testGrpcOkhttpRuntimeOnly", "io.grpc:grpc-okhttp")
add("testGrpcOkhttpRuntimeOnly", "io.grpc:grpc-stub")
testing {
suites {
val testGrpcNetty by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":exporters:otlp:testing-internal"))

implementation("io.grpc:grpc-netty")
implementation("io.grpc:grpc-stub")
}
}
val testGrpcNettyShaded by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":exporters:otlp:testing-internal"))

implementation("io.grpc:grpc-netty-shaded")
implementation("io.grpc:grpc-stub")
}
}
val testGrpcOkhttp by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":exporters:otlp:testing-internal"))

implementation("io.grpc:grpc-okhttp")
implementation("io.grpc:grpc-stub")
}
}
}
}

tasks {
named("check") {
dependsOn("testGrpcNetty", "testGrpcNettyShaded", "testGrpcOkhttp")
dependsOn(testing.suites)
}
}
46 changes: 29 additions & 17 deletions exporters/otlp/metrics/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,52 @@ plugins {
id("otel.java-conventions")
id("otel.publish-conventions")

id("org.unbroken-dome.test-sets")
id("otel.animalsniffer-conventions")
}

description = "OpenTelemetry Protocol Metrics Exporter"
otelJava.moduleName.set("io.opentelemetry.exporter.otlp.metrics")

testSets {
create("testGrpcNetty")
create("testGrpcNettyShaded")
create("testGrpcOkhttp")
}

dependencies {
api(project(":sdk:metrics"))
api(project(":exporters:otlp:common"))

compileOnly("io.grpc:grpc-stub")

testImplementation(project(":exporters:otlp:testing-internal"))
testImplementation(project(":sdk:testing"))

add("testGrpcNettyRuntimeOnly", "io.grpc:grpc-netty")
add("testGrpcNettyRuntimeOnly", "io.grpc:grpc-stub")

add("testGrpcNettyShadedRuntimeOnly", "io.grpc:grpc-netty-shaded")
add("testGrpcNettyShadedRuntimeOnly", "io.grpc:grpc-stub")
}

add("testGrpcOkhttpRuntimeOnly", "io.grpc:grpc-okhttp")
add("testGrpcOkhttpRuntimeOnly", "io.grpc:grpc-stub")
testing {
suites {
val testGrpcNetty by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":exporters:otlp:testing-internal"))

implementation("io.grpc:grpc-netty")
implementation("io.grpc:grpc-stub")
}
}
val testGrpcNettyShaded by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":exporters:otlp:testing-internal"))

implementation("io.grpc:grpc-netty-shaded")
implementation("io.grpc:grpc-stub")
}
}
val testGrpcOkhttp by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":exporters:otlp:testing-internal"))

implementation("io.grpc:grpc-okhttp")
implementation("io.grpc:grpc-stub")
}
}
}
}

tasks {
check {
dependsOn("testGrpcNetty", "testGrpcNettyShaded", "testGrpcOkhttp")
dependsOn(testing.suites)
}
}
5 changes: 2 additions & 3 deletions exporters/otlp/testing-internal/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ description = "OpenTelemetry Exporter Testing (Internal)"
otelJava.moduleName.set("io.opentelemetry.exporter.otlp.testing.internal")

dependencies {
api(project(":exporters:otlp:common"))
api(project(":sdk:logs"))
api(project(":sdk:metrics"))
api(project(":sdk:trace"))
api(project(":exporters:otlp:common"))

implementation(project(":sdk:testing"))
api(project(":sdk:testing"))

api("io.opentelemetry.proto:opentelemetry-proto")
api("org.junit.jupiter:junit-jupiter-api")
Expand Down
70 changes: 43 additions & 27 deletions exporters/otlp/trace/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,11 @@ plugins {

id("otel.animalsniffer-conventions")
id("otel.jmh-conventions")

id("org.unbroken-dome.test-sets")
}

description = "OpenTelemetry Protocol Trace Exporter"
otelJava.moduleName.set("io.opentelemetry.exporter.otlp.trace")

testSets {
create("testGrpcNetty")
create("testGrpcNettyShaded")
create("testGrpcOkhttp")

// Mainly to conveniently profile through IDEA. Don't add to check task, it's for
// manual invocation.
create("testSpanPipeline")
}

dependencies {
api(project(":sdk:trace"))
api(project(":exporters:otlp:common"))
Expand All @@ -30,20 +18,6 @@ dependencies {
compileOnly("io.grpc:grpc-stub")

testImplementation(project(":exporters:otlp:testing-internal"))
testImplementation(project(":sdk:testing"))

add("testGrpcNettyRuntimeOnly", "io.grpc:grpc-netty")
add("testGrpcNettyRuntimeOnly", "io.grpc:grpc-stub")

add("testGrpcNettyShadedRuntimeOnly", "io.grpc:grpc-netty-shaded")
add("testGrpcNettyShadedRuntimeOnly", "io.grpc:grpc-stub")

add("testGrpcOkhttpRuntimeOnly", "io.grpc:grpc-okhttp")
add("testGrpcOkhttpRuntimeOnly", "io.grpc:grpc-stub")

add("testSpanPipelineImplementation", "io.grpc:grpc-protobuf")
add("testSpanPipelineImplementation", "io.grpc:grpc-testing")
add("testSpanPipelineImplementation", "io.opentelemetry.proto:opentelemetry-proto")

jmhImplementation(project(":sdk:testing"))
jmhImplementation("com.linecorp.armeria:armeria")
Expand All @@ -53,8 +27,50 @@ dependencies {
jmhRuntimeOnly("io.grpc:grpc-netty")
}

testing {
suites {
val testGrpcNetty by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":exporters:otlp:testing-internal"))

implementation("io.grpc:grpc-netty")
implementation("io.grpc:grpc-stub")
}
}
val testGrpcNettyShaded by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":exporters:otlp:testing-internal"))

implementation("io.grpc:grpc-netty-shaded")
implementation("io.grpc:grpc-stub")
}
}
val testGrpcOkhttp by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":exporters:otlp:testing-internal"))

implementation("io.grpc:grpc-okhttp")
implementation("io.grpc:grpc-stub")
}
}
val testSpanPipeline by registering(JvmTestSuite::class) {
dependencies {
implementation("io.grpc:grpc-protobuf")
implementation("io.grpc:grpc-testing")
implementation("io.opentelemetry.proto:opentelemetry-proto")
}
}
}
}

tasks {
check {
dependsOn("testGrpcNetty", "testGrpcNettyShaded", "testGrpcOkhttp")
dependsOn(
testing.suites.filter {
// Mainly to conveniently profile through IDEA. Don't add to check task, it's for
// manual invocation.
name != "testSpanPipeline"
}
)
}
}
23 changes: 13 additions & 10 deletions exporters/prometheus/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@ plugins {
id("otel.publish-conventions")

id("otel.animalsniffer-conventions")

id("org.unbroken-dome.test-sets")
}

description = "OpenTelemetry Prometheus Exporter"
otelJava.moduleName.set("io.opentelemetry.exporter.prometheus")

testSets {
create("integrationTest")
}

dependencies {
api(project(":sdk:metrics"))

Expand All @@ -25,14 +19,23 @@ dependencies {
testImplementation("com.google.guava:guava")
testImplementation("com.linecorp.armeria:armeria")
testRuntimeOnly("org.slf4j:slf4j-simple")
}

add("integrationTestImplementation", "com.fasterxml.jackson.jr:jackson-jr-stree")
add("integrationTestImplementation", "com.linecorp.armeria:armeria")
add("integrationTestImplementation", "org.testcontainers:junit-jupiter")
testing {
suites {
val integrationTest by registering(JvmTestSuite::class) {
dependencies {
implementation("com.fasterxml.jackson.jr:jackson-jr-stree")
implementation("com.google.guava:guava")
implementation("com.linecorp.armeria:armeria")
implementation("org.testcontainers:junit-jupiter")
}
}
}
}

tasks {
check {
dependsOn("integrationTest")
dependsOn(testing.suites)
}
}
28 changes: 21 additions & 7 deletions extensions/kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,12 @@ plugins {

id("otel.jmh-conventions")
id("org.jetbrains.kotlin.jvm")
id("org.unbroken-dome.test-sets")
id("otel.animalsniffer-conventions")
}

description = "OpenTelemetry Kotlin Extensions"
otelJava.moduleName.set("io.opentelemetry.extension.kotlin")

testSets {
create("testStrictContext")
}

dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))

Expand All @@ -30,6 +25,25 @@ dependencies {
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2")
}

testing {
suites {
val testStrictContext by registering(JvmTestSuite::class) {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2")
}

targets {
all {
testTask.configure {
jvmArgs("-Dio.opentelemetry.context.enableStrictContext=true")
}
}
}
}
}
}

tasks {
withType(KotlinCompile::class) {
kotlinOptions {
Expand All @@ -42,7 +56,7 @@ tasks {
enabled = false
}

named<Test>("testStrictContext") {
jvmArgs("-Dio.opentelemetry.context.enableStrictContext=true")
check {
dependsOn(testing.suites)
}
}
Loading

0 comments on commit 8e04fbf

Please sign in to comment.