Skip to content

Commit

Permalink
Run aws-sdk tests against 2.18.x (#6956)
Browse files Browse the repository at this point in the history
Resolves
#6945
  • Loading branch information
laurit authored Oct 23, 2022
1 parent 94e2248 commit 5c2c86c
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 36 deletions.
15 changes: 8 additions & 7 deletions instrumentation/aws-sdk/aws-sdk-2.2/javaagent/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ dependencies {
testImplementation(project(":instrumentation:netty:netty-4.1:javaagent"))

latestDepTestLibrary("software.amazon.awssdk:aws-json-protocol:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:aws-core:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:dynamodb:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:ec2:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:kinesis:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:rds:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:s3:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:sqs:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:aws-core:+")
latestDepTestLibrary("software.amazon.awssdk:dynamodb:+")
latestDepTestLibrary("software.amazon.awssdk:ec2:+")
latestDepTestLibrary("software.amazon.awssdk:kinesis:+")
latestDepTestLibrary("software.amazon.awssdk:rds:+")
latestDepTestLibrary("software.amazon.awssdk:s3:+")
latestDepTestLibrary("software.amazon.awssdk:sqs:+")
}

tasks.withType<Test>().configureEach {
systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
// TODO run tests both with and without experimental span attributes
jvmArgs("-Dotel.instrumentation.aws-sdk.experimental-span-attributes=true")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@ dependencies {

testImplementation(project(":instrumentation:aws-sdk:aws-sdk-2.2:testing"))

latestDepTestLibrary("software.amazon.awssdk:aws-core:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:aws-json-protocol:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:dynamodb:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:ec2:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:kinesis:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:rds:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:s3:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:sqs:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:aws-core:+")
latestDepTestLibrary("software.amazon.awssdk:aws-json-protocol:+")
latestDepTestLibrary("software.amazon.awssdk:dynamodb:+")
latestDepTestLibrary("software.amazon.awssdk:ec2:+")
latestDepTestLibrary("software.amazon.awssdk:kinesis:+")
latestDepTestLibrary("software.amazon.awssdk:rds:+")
latestDepTestLibrary("software.amazon.awssdk:s3:+")
latestDepTestLibrary("software.amazon.awssdk:sqs:+")
}

tasks {
test {
systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
systemProperty("otel.instrumentation.aws-sdk.experimental-span-attributes", true)
}
}
17 changes: 9 additions & 8 deletions instrumentation/aws-sdk/aws-sdk-2.2/library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@ dependencies {

testImplementation(project(":instrumentation:aws-sdk:aws-sdk-2.2:testing"))

latestDepTestLibrary("software.amazon.awssdk:aws-core:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:aws-json-protocol:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:dynamodb:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:ec2:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:kinesis:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:rds:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:s3:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:sqs:2.17.+")
latestDepTestLibrary("software.amazon.awssdk:aws-core:+")
latestDepTestLibrary("software.amazon.awssdk:aws-json-protocol:+")
latestDepTestLibrary("software.amazon.awssdk:dynamodb:+")
latestDepTestLibrary("software.amazon.awssdk:ec2:+")
latestDepTestLibrary("software.amazon.awssdk:kinesis:+")
latestDepTestLibrary("software.amazon.awssdk:rds:+")
latestDepTestLibrary("software.amazon.awssdk:s3:+")
latestDepTestLibrary("software.amazon.awssdk:sqs:+")
}

tasks {
test {
systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
systemProperty("otel.instrumentation.aws-sdk.experimental-span-attributes", true)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,11 @@ abstract class AbstractAws2ClientTest extends InstrumentationSpecification {
request.request().headers().get("traceparent") == null

where:
service | operation | method | path | requestId | builder | call | body
"S3" | "CreateBucket" | "PUT" | "/somebucket" | "UNKNOWN" | S3Client.builder() | { c -> c.createBucket(CreateBucketRequest.builder().bucket("somebucket").build()) } | ""
"S3" | "GetObject" | "GET" | "/somebucket/somekey" | "UNKNOWN" | S3Client.builder() | { c -> c.getObject(GetObjectRequest.builder().bucket("somebucket").key("somekey").build()) } | ""
"Kinesis" | "DeleteStream" | "POST" | "" | "UNKNOWN" | KinesisClient.builder() | { c -> c.deleteStream(DeleteStreamRequest.builder().streamName("somestream").build()) } | ""
"Sqs" | "CreateQueue" | "POST" | "" | "7a62c49f-347e-4fc4-9331-6e8e7a96aa73" | SqsClient.builder() | { c -> c.createQueue(CreateQueueRequest.builder().queueName("somequeue").build()) } | """
service | operation | method | path | requestId | builder | call | body
"S3" | "CreateBucket" | "PUT" | path("somebucket") | "UNKNOWN" | S3Client.builder() | { c -> c.createBucket(CreateBucketRequest.builder().bucket("somebucket").build()) } | ""
"S3" | "GetObject" | "GET" | path("somebucket", "somekey") | "UNKNOWN" | S3Client.builder() | { c -> c.getObject(GetObjectRequest.builder().bucket("somebucket").key("somekey").build()) } | ""
"Kinesis" | "DeleteStream" | "POST" | "" | "UNKNOWN" | KinesisClient.builder() | { c -> c.deleteStream(DeleteStreamRequest.builder().streamName("somestream").build()) } | ""
"Sqs" | "CreateQueue" | "POST" | "" | "7a62c49f-347e-4fc4-9331-6e8e7a96aa73" | SqsClient.builder() | { c -> c.createQueue(CreateQueueRequest.builder().queueName("somequeue").build()) } | """
<CreateQueueResponse>
<CreateQueueResult><QueueUrl>https://queue.amazonaws.com/123456789012/MyQueue</QueueUrl></CreateQueueResult>
<ResponseMetadata><RequestId>7a62c49f-347e-4fc4-9331-6e8e7a96aa73</RequestId></ResponseMetadata>
Expand Down Expand Up @@ -476,18 +476,18 @@ abstract class AbstractAws2ClientTest extends InstrumentationSpecification {
request.request().headers().get("traceparent") == null

where:
service | operation | method | path | requestId | builder | call | body
"S3" | "CreateBucket" | "PUT" | "/somebucket" | "UNKNOWN" | S3AsyncClient.builder() | { c -> c.createBucket(CreateBucketRequest.builder().bucket("somebucket").build()) } | ""
"S3" | "GetObject" | "GET" | "/somebucket/somekey" | "UNKNOWN" | S3AsyncClient.builder() | { c -> c.getObject(GetObjectRequest.builder().bucket("somebucket").key("somekey").build(), AsyncResponseTransformer.toBytes()) } | "1234567890"
service | operation | method | path | requestId | builder | call | body
"S3" | "CreateBucket" | "PUT" | path("somebucket") | "UNKNOWN" | S3AsyncClient.builder() | { c -> c.createBucket(CreateBucketRequest.builder().bucket("somebucket").build()) } | ""
"S3" | "GetObject" | "GET" | path("somebucket", "somekey") | "UNKNOWN" | S3AsyncClient.builder() | { c -> c.getObject(GetObjectRequest.builder().bucket("somebucket").key("somekey").build(), AsyncResponseTransformer.toBytes()) } | "1234567890"
// Kinesis seems to expect an http2 response which is incompatible with our test server.
// "Kinesis" | "DeleteStream" | "POST" | "/" | "UNKNOWN" | KinesisAsyncClient.builder() | { c -> c.deleteStream(DeleteStreamRequest.builder().streamName("somestream").build()) } | ""
"Sqs" | "CreateQueue" | "POST" | "" | "7a62c49f-347e-4fc4-9331-6e8e7a96aa73" | SqsAsyncClient.builder() | { c -> c.createQueue(CreateQueueRequest.builder().queueName("somequeue").build()) } | """
"Sqs" | "CreateQueue" | "POST" | "" | "7a62c49f-347e-4fc4-9331-6e8e7a96aa73" | SqsAsyncClient.builder() | { c -> c.createQueue(CreateQueueRequest.builder().queueName("somequeue").build()) } | """
<CreateQueueResponse>
<CreateQueueResult><QueueUrl>https://queue.amazonaws.com/123456789012/MyQueue</QueueUrl></CreateQueueResult>
<ResponseMetadata><RequestId>7a62c49f-347e-4fc4-9331-6e8e7a96aa73</RequestId></ResponseMetadata>
</CreateQueueResponse>
"""
"Sqs" | "SendMessage" | "POST" | "" | "27daac76-34dd-47df-bd01-1f6e873584a0" | SqsAsyncClient.builder() | { c -> c.sendMessage(SendMessageRequest.builder().queueUrl("someurl").messageBody("").build()) } | """
"Sqs" | "SendMessage" | "POST" | "" | "27daac76-34dd-47df-bd01-1f6e873584a0" | SqsAsyncClient.builder() | { c -> c.sendMessage(SendMessageRequest.builder().queueUrl("someurl").messageBody("").build()) } | """
<SendMessageResponse>
<SendMessageResult>
<MD5OfMessageBody>d41d8cd98f00b204e9800998ecf8427e</MD5OfMessageBody>
Expand All @@ -497,14 +497,14 @@ abstract class AbstractAws2ClientTest extends InstrumentationSpecification {
<ResponseMetadata><RequestId>27daac76-34dd-47df-bd01-1f6e873584a0</RequestId></ResponseMetadata>
</SendMessageResponse>
"""
"Ec2" | "AllocateAddress" | "POST" | "" | "59dbff89-35bd-4eac-99ed-be587EXAMPLE" | Ec2AsyncClient.builder() | { c -> c.allocateAddress() } | """
"Ec2" | "AllocateAddress" | "POST" | "" | "59dbff89-35bd-4eac-99ed-be587EXAMPLE" | Ec2AsyncClient.builder() | { c -> c.allocateAddress() } | """
<AllocateAddressResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
<requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
<publicIp>192.0.2.1</publicIp>
<domain>standard</domain>
</AllocateAddressResponse>
"""
"Rds" | "DeleteOptionGroup" | "POST" | "" | "0ac9cda2-bbf4-11d3-f92b-31fa5e8dbc99" | RdsAsyncClient.builder() | { c -> c.deleteOptionGroup(DeleteOptionGroupRequest.builder().build()) } | """
"Rds" | "DeleteOptionGroup" | "POST" | "" | "0ac9cda2-bbf4-11d3-f92b-31fa5e8dbc99" | RdsAsyncClient.builder() | { c -> c.deleteOptionGroup(DeleteOptionGroupRequest.builder().build()) } | """
<DeleteOptionGroupResponse xmlns="http://rds.amazonaws.com/doc/2014-09-01/">
<ResponseMetadata><RequestId>0ac9cda2-bbf4-11d3-f92b-31fa5e8dbc99</RequestId></ResponseMetadata>
</DeleteOptionGroupResponse>
Expand Down Expand Up @@ -535,6 +535,7 @@ abstract class AbstractAws2ClientTest extends InstrumentationSpecification {
then:
thrown SdkClientException

def path = path("somebucket", "somekey")
assertTraces(1) {
trace(0, 1) {
span(0) {
Expand All @@ -547,7 +548,7 @@ abstract class AbstractAws2ClientTest extends InstrumentationSpecification {
"$SemanticAttributes.NET_TRANSPORT" IP_TCP
"$SemanticAttributes.NET_PEER_NAME" "127.0.0.1"
"$SemanticAttributes.NET_PEER_PORT" server.httpPort()
"$SemanticAttributes.HTTP_URL" "${server.httpUri()}/somebucket/somekey"
"$SemanticAttributes.HTTP_URL" "${server.httpUri()}${path}"
"$SemanticAttributes.HTTP_METHOD" "GET"
"$SemanticAttributes.HTTP_FLAVOR" "1.1"
"$SemanticAttributes.RPC_SYSTEM" "aws-api"
Expand All @@ -560,4 +561,16 @@ abstract class AbstractAws2ClientTest extends InstrumentationSpecification {
}
}
}

static String path(String bucket, String path = null) {
def result = ""
// since 2.18.0 bucket name is not present in request path
if (!Boolean.getBoolean("testLatestDeps") && !bucket.isEmpty()) {
result = "/" + bucket
}
if (path != null && !path.isEmpty()) {
result += "/" + path
}
return result
}
}

0 comments on commit 5c2c86c

Please sign in to comment.