Skip to content

Commit bf02b3f

Browse files
Fixed tests.
1 parent d03fee4 commit bf02b3f

File tree

5 files changed

+12
-16
lines changed

5 files changed

+12
-16
lines changed

dd-java-agent/instrumentation/jackson-core/jackson-core-2.12/src/test/groovy/datadog/trace/instrumentation/jackson212/core/JsonParserInstrumentationTest.groovy

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ class JsonParserInstrumentationTest extends InstrumentationSpecification {
3636
JsonOutput.toJson(taintedResult) == JSON_STRING
3737
_ * module.taintObjectIfTainted(_, _)
3838
_ * module.findSource(_) >> source
39-
// TODO: Mock can not resolve method with 5 args under Groovy 4
40-
// 1 * module.taintString(_, 'root', source.origin, 'root', JSON_STRING)
41-
// 1 * module.taintString(_, 'nested', source.origin, 'nested', JSON_STRING)
39+
1 * module.taintString(_, 'root', source.origin, 'root', JSON_STRING)
40+
1 * module.taintString(_, 'nested', source.origin, 'nested', JSON_STRING)
4241
0 * _
4342
}
4443

dd-java-agent/instrumentation/jackson-core/jackson-core-2.6/src/test/groovy/datadog/trace/instrumentation/jackson26/core/JsonParserInstrumentationTest.groovy

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ class JsonParserInstrumentationTest extends InstrumentationSpecification {
3636
JsonOutput.toJson(taintedResult) == JSON_STRING
3737
_ * module.taintObjectIfTainted(_, _)
3838
_ * module.findSource(_) >> source
39-
// TODO Groovy 4 failed
40-
// 1 * module.taintString(_, 'root', source.origin, 'root', JSON_STRING)
41-
// 1 * module.taintString(_, 'nested', source.origin, 'nested', JSON_STRING)
39+
1 * module.taintString(_, 'root', source.origin, 'root', JSON_STRING)
40+
1 * module.taintString(_, 'nested', source.origin, 'nested', JSON_STRING)
4241
0 * _
4342
}
4443

dd-java-agent/instrumentation/jackson-core/jackson-core-2.8/src/test/groovy/datadog/trace/instrumentation/jackson28/core/JsonParserInstrumentationTest.groovy

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ class JsonParserInstrumentationTest extends InstrumentationSpecification {
3636
JsonOutput.toJson(taintedResult) == JSON_STRING
3737
_ * module.taintObjectIfTainted(_, _)
3838
_ * module.findSource(_) >> source
39-
// TODO: Groovy 4 issues
40-
// 1 * module.taintString(_, 'root', source.origin, 'root', JSON_STRING)
41-
// 1 * module.taintString(_, 'nested', source.origin, 'nested', JSON_STRING)
39+
1 * module.taintString(_, 'root', source.origin, 'root', JSON_STRING)
40+
1 * module.taintString(_, 'nested', source.origin, 'nested', JSON_STRING)
4241
0 * _
4342
}
4443

dd-java-agent/instrumentation/jackson-core/jackson-core-2/src/test/groovy/datadog/trace/instrumentation/jackson2/core/JsonParserInstrumentationTest.groovy

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ class JsonParserInstrumentationTest extends InstrumentationSpecification {
3636
JsonOutput.toJson(taintedResult) == JSON_STRING
3737
_ * module.taintObjectIfTainted(_, _)
3838
_ * module.findSource(_) >> source
39-
// TODO: Groovy 4 issues
40-
// 1 * module.taintString(_, 'root', source.origin, 'root', JSON_STRING)
41-
// 1 * module.taintString(_, 'nested', source.origin, 'nested', JSON_STRING)
39+
1 * module.taintString(_, 'root', source.origin, 'root', JSON_STRING)
40+
1 * module.taintString(_, 'nested', source.origin, 'nested', JSON_STRING)
4241
0 * _
4342
}
4443

dd-java-agent/instrumentation/java/java-nio-1.8/src/test/groovy/DirectAllocationTrackingTest.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ class DirectAllocationTrackingTest extends InstrumentationSpecification {
5353
def sample = directAllocations.find({ it.getEventType().name.equals("datadog.DirectAllocationSample")})
5454
sample.getLong("allocated") == 20
5555
sample.getString("source") == "MMAP"
56-
sample.getString("allocatingClass") == "org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite"
56+
sample.getString("allocatingClass") == "org.codehaus.groovy.vmplugin.v8.IndyInterface" // TODO: Groovy 4: "org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite"
5757
sample.getLong("spanId") == expectedSpanId.get()
5858
def total = directAllocations.find({ it.getEventType().name.equals("datadog.DirectAllocationTotal")})
5959
total.getLong("allocated") == 20
6060
total.getString("source") == "MMAP"
61-
total.getString("allocatingClass") == "org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite"
61+
total.getString("allocatingClass") == "org.codehaus.groovy.vmplugin.v8.IndyInterface" // TODO Groovy 4: "org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite"
6262

6363
cleanup:
6464
recording.close()
@@ -80,12 +80,12 @@ class DirectAllocationTrackingTest extends InstrumentationSpecification {
8080
def sample = directAllocations.find({ it.getEventType().name.equals("datadog.DirectAllocationSample")})
8181
sample.getLong("allocated") == 10
8282
sample.getString("source") == "ALLOCATE_DIRECT"
83-
sample.getString("allocatingClass") == "java_nio_ByteBuffer\$allocateDirect"
83+
sample.getString("allocatingClass") == "org.codehaus.groovy.vmplugin.v8.IndyInterface" // TODO: Groovy 4: "java_nio_ByteBuffer\$allocateDirect"
8484
sample.getLong("spanId") == expectedSpanId.get()
8585
def total = directAllocations.find({ it.getEventType().name.equals("datadog.DirectAllocationTotal")})
8686
total.getLong("allocated") == 10
8787
total.getString("source") == "ALLOCATE_DIRECT"
88-
total.getString("allocatingClass") == "java_nio_ByteBuffer\$allocateDirect"
88+
total.getString("allocatingClass") == "org.codehaus.groovy.vmplugin.v8.IndyInterface"// TODO Groovy 4"java_nio_ByteBuffer\$allocateDirect"
8989

9090
cleanup:
9191
recording.close()

0 commit comments

Comments
 (0)