Enable ignored aws tests (#4569)

* Enable ignored aws tests

* remove unused import
This commit is contained in:
Lauri Tulmin 2021-11-02 23:25:45 +02:00 committed by GitHub
parent 2aaf4cd961
commit 077dac8c5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 87 deletions

View File

@ -19,6 +19,7 @@ import com.amazonaws.services.sqs.AmazonSQSAsyncClient
import com.amazonaws.services.sqs.model.GetQueueAttributesRequest
import com.amazonaws.services.sqs.model.PurgeQueueRequest
import com.amazonaws.services.sqs.model.ReceiveMessageRequest
import java.time.Duration
import org.slf4j.LoggerFactory
import org.testcontainers.containers.localstack.LocalStackContainer
import org.testcontainers.containers.output.Slf4jLogConsumer
@ -36,9 +37,10 @@ class AwsConnector {
AwsConnector awsConnector = new AwsConnector()
awsConnector.localstack = new LocalStackContainer(DockerImageName.parse("localstack/localstack:latest"))
.withServices(LocalStackContainer.Service.SQS, LocalStackContainer.Service.SNS)
.withServices(LocalStackContainer.Service.SQS, LocalStackContainer.Service.SNS, LocalStackContainer.Service.S3)
.withEnv("DEBUG", "1")
.withEnv("SQS_PROVIDER", "elasticmq")
.withStartupTimeout(Duration.ofMinutes(2))
awsConnector.localstack.start()
awsConnector.localstack.followOutput(new Slf4jLogConsumer(LoggerFactory.getLogger("test")))

View File

@ -4,15 +4,12 @@
*/
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
import spock.lang.Ignore
import spock.lang.Shared
import static io.opentelemetry.api.trace.SpanKind.CLIENT
import static io.opentelemetry.api.trace.SpanKind.CONSUMER
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NetTransportValues.IP_TCP
@Ignore("Requires https://github.com/localstack/localstack/issues/3686 and #3669")
class S3TracingTest extends AgentInstrumentationSpecification {
@Shared
@ -45,7 +42,7 @@ class S3TracingTest extends AgentInstrumentationSpecification {
awsConnector.purgeQueue(queueUrl)
then:
assertTraces(13) {
assertTraces(12) {
trace(0, 1) {
span(0) {
@ -177,33 +174,7 @@ class S3TracingTest extends AgentInstrumentationSpecification {
}
}
}
/**
* This span represents HTTP "sending of receive message" operation. It's always single, while there can be multiple CONSUMER spans (one per consumed message).
* This one could be suppressed (by IF in TracingRequestHandler#beforeRequest but then HTTP instrumentation span would appear
*/
trace(6, 1) {
span(0) {
name "SQS.ReceiveMessage"
kind CONSUMER
hasNoParent()
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" String
"aws.operation" "ReceiveMessage"
"aws.queue.url" queueUrl
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
"http.method" "POST"
"http.status_code" 200
"http.url" String
"http.user_agent" String
"net.peer.name" String
"net.transport" IP_TCP
"net.peer.port" { it == null || Number }
}
}
}
trace(7, 2) {
trace(6, 2) {
span(0) {
name "S3.PutObject"
kind CLIENT
@ -244,11 +215,12 @@ class S3TracingTest extends AgentInstrumentationSpecification {
}
}
}
/**
* This span represents HTTP "sending of receive message" operation. It's always single, while there can be multiple CONSUMER spans (one per consumed message).
* This one could be suppressed (by IF in TracingRequestHandler#beforeRequest but then HTTP instrumentation span would appear
*/
trace(8, 1) {
trace(7, 1) {
span(0) {
name "SQS.ReceiveMessage"
kind CLIENT
@ -269,7 +241,7 @@ class S3TracingTest extends AgentInstrumentationSpecification {
}
}
}
trace(9, 1) {
trace(8, 1) {
span(0) {
name "S3.ListObjects"
kind CLIENT
@ -290,7 +262,7 @@ class S3TracingTest extends AgentInstrumentationSpecification {
}
}
}
trace(10, 1) {
trace(9, 1) {
span(0) {
name "S3.DeleteObject"
kind CLIENT
@ -311,7 +283,7 @@ class S3TracingTest extends AgentInstrumentationSpecification {
}
}
}
trace(11, 1) {
trace(10, 1) {
span(0) {
name "S3.DeleteBucket"
kind CLIENT
@ -332,7 +304,7 @@ class S3TracingTest extends AgentInstrumentationSpecification {
}
}
}
trace(12, 1) {
trace(11, 1) {
span(0) {
name "SQS.PurgeQueue"
kind CLIENT
@ -570,33 +542,7 @@ class S3TracingTest extends AgentInstrumentationSpecification {
}
}
}
/**
* This span represents HTTP "sending of receive message" operation. It's always single, while there can be multiple CONSUMER spans (one per consumed message).
* This one could be suppressed (by IF in TracingRequestHandler#beforeRequest but then HTTP instrumentation span would appear
*/
trace(9, 1) {
span(0) {
name "SQS.ReceiveMessage"
kind CONSUMER
hasNoParent()
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" String
"aws.operation" "ReceiveMessage"
"aws.queue.url" queueUrl
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
"http.method" "POST"
"http.status_code" 200
"http.url" String
"http.user_agent" String
"net.peer.name" String
"net.transport" IP_TCP
"net.peer.port" { it == null || Number }
}
}
}
trace(10, 2) {
span(0) {
name "S3.PutObject"
kind CLIENT
@ -616,32 +562,12 @@ class S3TracingTest extends AgentInstrumentationSpecification {
"net.peer.port" { it == null || Number }
}
}
span(1) {
name "SQS.ReceiveMessage"
kind CONSUMER
childOf span(0)
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" String
"aws.operation" "ReceiveMessage"
"aws.queue.url" queueUrl
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
"http.method" "POST"
"http.status_code" 200
"http.url" String
"http.user_agent" String
"net.peer.name" String
"net.transport" IP_TCP
"net.peer.port" { it == null || Number }
}
}
}
/**
* This span represents HTTP "sending of receive message" operation. It's always single, while there can be multiple CONSUMER spans (one per consumed message).
* This one could be suppressed (by IF in TracingRequestHandler#beforeRequest but then HTTP instrumentation span would appear
*/
trace(11, 1) {
trace(10, 1) {
span(0) {
name "SQS.ReceiveMessage"
kind CLIENT
@ -662,6 +588,28 @@ class S3TracingTest extends AgentInstrumentationSpecification {
}
}
}
trace(11, 1) {
span(0) {
name "SQS.ReceiveMessage"
kind CONSUMER
hasNoParent()
attributes {
"aws.agent" "java-aws-sdk"
"aws.endpoint" String
"aws.operation" "ReceiveMessage"
"aws.queue.url" queueUrl
"aws.service" "AmazonSQS"
"http.flavor" "1.1"
"http.method" "POST"
"http.status_code" 200
"http.url" String
"http.user_agent" String
"net.peer.name" String
"net.transport" IP_TCP
"net.peer.port" { it == null || Number }
}
}
}
trace(12, 1) {
span(0) {
name "S3.ListObjects"

View File

@ -4,18 +4,16 @@
*/
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
import spock.lang.Ignore
import spock.lang.Shared
import static io.opentelemetry.api.trace.SpanKind.CLIENT
import static io.opentelemetry.api.trace.SpanKind.CONSUMER
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NetTransportValues.IP_TCP
@Ignore("Requires https://github.com/localstack/localstack/issues/3669 to work with localstack")
class SnsTracingTest extends AgentInstrumentationSpecification {
@Shared
AwsConnector awsConnector = AwsConnector.liveAws()
AwsConnector awsConnector = AwsConnector.localstack()
def cleanupSpec() {