Skip to content

Commit 0765d26

Browse files
committed
fix tests
1 parent ed2994b commit 0765d26

File tree

2 files changed

+61
-3
lines changed

2 files changed

+61
-3
lines changed

dd-java-agent/instrumentation/protobuf/src/test/groovy/com/datadog/instrumentation/protobuf/AbstractMessageInstrumentationTest.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class AbstractMessageInstrumentationTest extends AgentTestRunner {
183183
runUnderTrace("parent_deserialize") {
184184
AgentSpan span = activeSpan()
185185
span.setTag(DDTags.MANUAL_KEEP, true)
186-
MyMessage.parseFrom(bytes)
186+
RecursiveMessage.parseFrom(bytes)
187187
}
188188
TEST_WRITER.waitForTraces(2)
189189
then:

dd-java-agent/instrumentation/protobuf/src/test/groovy/com/datadog/instrumentation/protobuf/DynamicMessageInstrumentationTest.groovy

+60-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,66 @@ class DynamicMessageInstrumentationTest extends AgentTestRunner {
2222
.setValue("Hello from Protobuf!")
2323
.build()
2424
when:
25-
String expectedSchema = "{\"components\":{\"schemas\":{\"com.datadog.instrumentation.protobuf.generated.MyMessage\":{\"properties\":{\"id\":{\"extensions\":{\"x-protobuf-number\":\"1\"},\"type\":\"string\"},\"value\":{\"extensions\":{\"x-protobuf-number\":\"2\"},\"type\":\"string\"},\"other_message\":{\"extensions\":{\"x-protobuf-number\":\"3\"},\"items\":{\"\$ref\":\"#/components/schemas/com.datadog.instrumentation.protobuf.generated.OtherMessage\"},\"type\":\"array\"}},\"type\":\"object\"},\"com.datadog.instrumentation.protobuf.generated.OtherMessage\":{\"properties\":{\"name\":{\"extensions\":{\"x-protobuf-number\":\"1\"},\"type\":\"string\"},\"age\":{\"extensions\":{\"x-protobuf-number\":\"2\"},\"format\":\"int32\",\"type\":\"integer\"}},\"type\":\"object\"}}},\"openapi\":\"3.0.0\"}"
26-
String expectedSchemaID = "4690647329509494987"
25+
String expectedSchema = """{
26+
"components":{
27+
"schemas":{
28+
"com.datadog.instrumentation.protobuf.generated.MyMessage":{
29+
"properties":{
30+
"id":{
31+
"extensions":{
32+
"x-protobuf-number":"1"
33+
},
34+
"type":"string"
35+
},
36+
"value":{
37+
"extensions":{
38+
"x-protobuf-number":"2"
39+
},
40+
"type":"string"
41+
},
42+
"other_message":{
43+
"extensions":{
44+
"x-protobuf-number":"3"
45+
},
46+
"items":{
47+
"\$ref":"#/components/schemas/com.datadog.instrumentation.protobuf.generated.OtherMessage"
48+
},
49+
"type":"array"
50+
},
51+
"nested":{
52+
"\$ref":"#/components/schemas/com.datadog.instrumentation.protobuf.generated.OtherMessage",
53+
"extensions":{
54+
"x-protobuf-number":"4"
55+
}
56+
}
57+
},
58+
"type":"object"
59+
},
60+
"com.datadog.instrumentation.protobuf.generated.OtherMessage":{
61+
"properties":{
62+
"name":{
63+
"extensions":{
64+
"x-protobuf-number":"1"
65+
},
66+
"type":"string"
67+
},
68+
"age":{
69+
"extensions":{
70+
"x-protobuf-number":"2"
71+
},
72+
"format":"int32",
73+
"type":"integer"
74+
}
75+
},
76+
"type":"object"
77+
}
78+
}
79+
},
80+
"openapi":"3.0.0"
81+
}"""
82+
expectedSchema = expectedSchema.replaceAll("[ \n]", "") // the spaces are just here to make it readable
83+
String expectedSchemaID = "2792908287829424040"
84+
2785
var bytes
2886
runUnderTrace("parent_serialize") {
2987
AgentSpan span = activeSpan()

0 commit comments

Comments
 (0)