Convert aws-sdk tests to test suites (#7943)

Part of
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/7911
This commit is contained in:
Lauri Tulmin 2023-03-01 21:25:53 +02:00 committed by GitHub
parent 8c1b072682
commit 13c7617be1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 35 additions and 42 deletions

View File

@ -1,6 +1,5 @@
plugins { plugins {
id("otel.javaagent-instrumentation") id("otel.javaagent-instrumentation")
id("org.unbroken-dome.test-sets")
} }
// compiling against 1.11.0, but instrumentation should work against 1.10.33 with varying effects, // compiling against 1.11.0, but instrumentation should work against 1.10.33 with varying effects,
@ -19,33 +18,6 @@ muzzle {
} }
} }
testSets {
// Features used in test_1_11_106 (builder) is available since 1.11.84, but
// using 1.11.106 because of previous concerns with byte code differences
// in 1.11.106, also, the DeleteOptionGroup request generates more spans
// in 1.11.106 than 1.11.84.
// We test older version in separate test set to test newer version and latest deps in the 'default'
// test dir. Otherwise we get strange warnings in Idea.
create("test_before_1_11_106")
// We test SQS separately since we have special logic for it and want to make sure the presence of
// SQS on the classpath doesn't conflict with tests for usage of the core SDK. This only affects
// the agent.
create("testSqs")
}
configurations {
named("test_before_1_11_106RuntimeClasspath") {
resolutionStrategy.force("com.amazonaws:aws-java-sdk-s3:1.11.0")
resolutionStrategy.force("com.amazonaws:aws-java-sdk-rds:1.11.0")
resolutionStrategy.force("com.amazonaws:aws-java-sdk-ec2:1.11.0")
resolutionStrategy.force("com.amazonaws:aws-java-sdk-kinesis:1.11.0")
resolutionStrategy.force("com.amazonaws:aws-java-sdk-sqs:1.11.0")
resolutionStrategy.force("com.amazonaws:aws-java-sdk-sns:1.11.0")
resolutionStrategy.force("com.amazonaws:aws-java-sdk-dynamodb:1.11.0")
}
}
dependencies { dependencies {
compileOnly("io.opentelemetry.contrib:opentelemetry-aws-xray-propagator") compileOnly("io.opentelemetry.contrib:opentelemetry-aws-xray-propagator")
@ -62,8 +34,6 @@ dependencies {
testImplementation(project(":instrumentation:aws-sdk:aws-sdk-1.11:testing")) testImplementation(project(":instrumentation:aws-sdk:aws-sdk-1.11:testing"))
add("testSqsImplementation", "com.amazonaws:aws-java-sdk-sqs:1.11.106")
// Include httpclient instrumentation for testing because it is a dependency for aws-sdk. // Include httpclient instrumentation for testing because it is a dependency for aws-sdk.
testInstrumentation(project(":instrumentation:apache-httpclient:apache-httpclient-4.0:javaagent")) testInstrumentation(project(":instrumentation:apache-httpclient:apache-httpclient-4.0:javaagent"))
@ -75,23 +45,46 @@ dependencies {
// needed by S3 // needed by S3
testImplementation("javax.xml.bind:jaxb-api:2.3.1") testImplementation("javax.xml.bind:jaxb-api:2.3.1")
}
add("test_before_1_11_106Implementation", "com.amazonaws:aws-java-sdk-s3:1.11.0") testing {
add("test_before_1_11_106Implementation", "com.amazonaws:aws-java-sdk-rds:1.11.0") suites {
add("test_before_1_11_106Implementation", "com.amazonaws:aws-java-sdk-ec2:1.11.0") // Features used in test_1_11_106 (builder) is available since 1.11.84, but
add("test_before_1_11_106Implementation", "com.amazonaws:aws-java-sdk-kinesis:1.11.0") // using 1.11.106 because of previous concerns with byte code differences
add("test_before_1_11_106Implementation", "com.amazonaws:aws-java-sdk-dynamodb:1.11.0") // in 1.11.106, also, the DeleteOptionGroup request generates more spans
add("test_before_1_11_106Implementation", "com.amazonaws:aws-java-sdk-sns:1.11.0") // in 1.11.106 than 1.11.84.
// We test older version in separate test set to test newer version and latest deps in the 'default'
// test dir. Otherwise we get strange warnings in Idea.
val test_before_1_11_106 by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":instrumentation:aws-sdk:aws-sdk-1.11:testing"))
implementation("com.amazonaws:aws-java-sdk-s3:1.11.0")
implementation("com.amazonaws:aws-java-sdk-rds:1.11.0")
implementation("com.amazonaws:aws-java-sdk-ec2:1.11.0")
implementation("com.amazonaws:aws-java-sdk-kinesis:1.11.0")
implementation("com.amazonaws:aws-java-sdk-dynamodb:1.11.0")
implementation("com.amazonaws:aws-java-sdk-sns:1.11.0")
}
}
// We test SQS separately since we have special logic for it and want to make sure the presence of
// SQS on the classpath doesn't conflict with tests for usage of the core SDK. This only affects
// the agent.
val testSqs by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":instrumentation:aws-sdk:aws-sdk-1.11:testing"))
implementation("com.amazonaws:aws-java-sdk-sqs:1.11.106")
}
}
}
} }
tasks { tasks {
val test_before_1_11_106 by existing
val testSqs by existing
if (!(findProperty("testLatestDeps") as Boolean)) { if (!(findProperty("testLatestDeps") as Boolean)) {
named("check") { check {
dependsOn(test_before_1_11_106) dependsOn(testing.suites)
dependsOn(testSqs)
} }
} }