Skip to content

Commit af87d96

Browse files
committed
add test for non json message
1 parent e8d3d4e commit af87d96

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

dd-java-agent/instrumentation/aws-java-sqs-1.0/src/test/groovy/SqsClientTest.groovy

+31
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,37 @@ class SqsClientV1DataStreamsForkedTest extends SqsClientTest {
614614
cleanup:
615615
client.shutdown()
616616
}
617+
618+
619+
def "Data streams context not extracted from message body when message is not a Json"() {
620+
setup:
621+
def client = AmazonSQSClientBuilder.standard()
622+
.withEndpointConfiguration(endpoint)
623+
.withCredentials(credentialsProvider)
624+
.build()
625+
def queueUrl = client.createQueue('somequeue').queueUrl
626+
TEST_WRITER.clear()
627+
628+
when:
629+
injectSysConfig(GeneralConfig.DATA_STREAMS_ENABLED, "false")
630+
client.sendMessage(queueUrl, '{"Message": "not a json"')
631+
injectSysConfig(GeneralConfig.DATA_STREAMS_ENABLED, "true")
632+
def messages = client.receiveMessage(queueUrl).messages
633+
messages.forEach {}
634+
635+
TEST_DATA_STREAMS_WRITER.waitForGroups(1)
636+
637+
then:
638+
StatsGroup first = TEST_DATA_STREAMS_WRITER.groups.find { it.parentHash == 0 }
639+
640+
verifyAll(first) {
641+
edgeTags == ["direction:in", "topic:somequeue", "type:sqs"]
642+
edgeTags.size() == 3
643+
}
644+
645+
cleanup:
646+
client.shutdown()
647+
}
617648
}
618649

619650

0 commit comments

Comments
 (0)