Skip to content

Commit 85b316b

Browse files
Fix test name uniqueness (#7720)
1 parent 5a939c0 commit 85b316b

File tree

22 files changed

+178
-174
lines changed

22 files changed

+178
-174
lines changed

dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/ExcludeFilterTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import static datadog.trace.bootstrap.instrumentation.java.concurrent.ExcludeFil
99

1010
class ExcludeFilterTest extends DDSpecification {
1111

12-
def "test empty ExcludeFilter"() {
12+
def "test empty ExcludeFilter #type.name()"() {
1313
setup:
1414
def one = new One()
1515
def oneName = One.getName()
@@ -22,7 +22,7 @@ class ExcludeFilterTest extends DDSpecification {
2222
type << ExcludeFilter.ExcludeType.values()
2323
}
2424

25-
def "test ExcludeFilter"() {
25+
def "test ExcludeFilter #type.name()"() {
2626
setup:
2727
def another = new Another()
2828
def anotherName = Another.getName()

dd-java-agent/agent-builder/src/test/groovy/datadog/trace/agent/test/DefaultInstrumenterForkedTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class DefaultInstrumenterForkedTest extends DDSpecification {
2020
target.enabled
2121
}
2222

23-
def "default enabled override"() {
23+
def "default enabled override #enabled"() {
2424
expect:
2525
target.enabled == enabled
2626

dd-java-agent/agent-debugger/debugger-el/src/test/java/com/datadog/debugger/el/expressions/ComparisonExpressionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
class ComparisonExpressionTest {
2929

30-
@ParameterizedTest
30+
@ParameterizedTest(name = "[{index}] {4}")
3131
@MethodSource("expressions")
3232
void evaluateOperator(
3333
ValueExpression<?> left,

dd-java-agent/agent-iast/src/test/groovy/com/datadog/iast/IastTagTest.groovy

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import static com.datadog.iast.IastTag.Enabled.SKIPPED
99

1010
class IastTagTest extends DDSpecification {
1111

12-
void 'tags are sent on the segment'() {
12+
void 'tags are sent on the segment (#tagName)'() {
1313
given:
1414
final segment = Mock(TraceSegment)
1515
@@ -20,25 +20,25 @@ class IastTagTest extends DDSpecification {
2020
1 * segment.setTagTop(tag.key(), tag.value())
2121
2222
where:
23-
tag | _
24-
ANALYZED | _
25-
SKIPPED | _
23+
tagName | tag
24+
"analyzed" | ANALYZED
25+
"skipped" | SKIPPED
2626
}
2727
28-
void 'tags dont fail with null segment'() {
28+
void 'tags dont fail with null segment (#tagName)'() {
2929
when:
3030
tag.setTagTop(null)
3131
3232
then:
3333
noExceptionThrown()
3434
3535
where:
36-
tag | _
37-
ANALYZED | _
38-
SKIPPED | _
36+
tagName | tag
37+
"analyzed" | ANALYZED
38+
"skipped" | SKIPPED
3939
}
4040
41-
void 'tags are sent on the span'() {
41+
void 'tags are sent on the span (#tagName)'() {
4242
given:
4343
final span = Mock(AgentSpan)
4444
@@ -49,22 +49,22 @@ class IastTagTest extends DDSpecification {
4949
1 * span.setTag(tag.key(), tag.value())
5050
5151
where:
52-
tag | _
53-
ANALYZED | _
54-
SKIPPED | _
52+
tagName | tag
53+
"analyzed" | ANALYZED
54+
"skipped" | SKIPPED
5555
}
5656
57-
void 'tags dont fail with null span'() {
57+
void 'tags dont fail with null span (#tagName)'() {
5858
when:
5959
tag.setTag(null)
6060
6161
then:
6262
noExceptionThrown()
6363
6464
where:
65-
tag | _
66-
ANALYZED | _
67-
SKIPPED | _
65+
tagName | tag
66+
"analyzed" | ANALYZED
67+
"skipped" | SKIPPED
6868
}
6969
7070
void 'enabled tags are not set if IAST is opt-out'() {

dd-java-agent/agent-iast/src/test/groovy/com/datadog/iast/model/json/EvidenceRedactionTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class EvidenceRedactionTest extends DDSpecification {
5858
vulnerabilitiesParser = moshi.adapter(Types.newParameterizedType(List, Vulnerability))
5959
}
6060

61-
void 'test empty value parts'() {
61+
void 'test empty value parts #iterationIndex'() {
6262
given:
6363
final writer = Stub(JsonWriter)
6464
final ctx = new AdapterFactory.Context()

dd-java-agent/agent-iast/src/test/groovy/com/datadog/iast/propagation/PropagationModuleTest.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class PropagationModuleTest extends IastModuleImplTestBase {
3939
}
4040
}
4141

42-
void '#method(#args) not taintable'() {
42+
void '#method(#argTypes) not taintable'() {
4343
when: 'there is no context by default'
4444
module.&"$method".call(args.toArray())
4545

@@ -102,6 +102,7 @@ class PropagationModuleTest extends IastModuleImplTestBase {
102102
]
103103
'findSource' | [null]
104104
'isTainted' | [null]
105+
argTypes = args*.class.name
105106
}
106107

107108
void '#method without span'() {

dd-java-agent/agent-tooling/src/test/groovy/datadog/trace/agent/test/ResourceLocatingTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ResourceLocatingTest extends DDSpecification {
2424
lastLookup.set(null)
2525
}
2626

27-
def "finds resources from parent classloader"() {
27+
def "finds resources from parent classloader #locator.class.name"() {
2828
expect:
2929
locator.locate("java/lang/Object").isResolved() == usesProvidedClassloader
3030
// lastLookup verifies that the given classloader is only used when expected

dd-java-agent/agent-tooling/src/test/groovy/datadog/trace/agent/tooling/csi/AdvicesInvokeDynamicTest.groovy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import spock.lang.Requires
1010
})
1111
class AdvicesInvokeDynamicTest extends BaseCallSiteTest {
1212

13-
void 'test constant pool introspector with invoke dynamic'() {
13+
void 'test constant pool introspector with invoke dynamic #pointcutName'() {
1414
setup:
1515
final type = new TypeDescription.ForLoadedType(StringPlusExample)
1616
final advice = Stub(InvokeDynamicAdvice)
@@ -29,9 +29,10 @@ class AdvicesInvokeDynamicTest extends BaseCallSiteTest {
2929
pointcutMock | emptyAdvices | adviceFound
3030
stringConcatPointcut() | true | false
3131
stringConcatFactoryPointcut() | false | true
32+
pointcutName = pointcutMock.descriptor
3233
}
3334

34-
void 'test constant pool introspector with invoke dynamic and constants'() {
35+
void 'test constant pool introspector with invoke dynamic and constants #pointcutName'() {
3536
setup:
3637
final type = new TypeDescription.ForLoadedType(StringPlusConstantsExample)
3738
final advice = Stub(InvokeDynamicAdvice)
@@ -50,5 +51,6 @@ class AdvicesInvokeDynamicTest extends BaseCallSiteTest {
5051
pointcutMock | emptyAdvices | adviceFound
5152
stringConcatPointcut() | true | false
5253
stringConcatFactoryPointcut() | false | true
54+
pointcutName = pointcutMock.descriptor
5355
}
5456
}

dd-java-agent/appsec/src/test/groovy/com/datadog/appsec/powerwaf/DataBundleMapWrapperSpecification.groovy

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DataBundleMapWrapperSpecification extends DDSpecification {
2525
def elem
2626

2727
expect:
28-
iter.hasNext() == true
28+
iter.hasNext()
2929

3030
when:
3131
elem = iter.next()
@@ -46,7 +46,7 @@ class DataBundleMapWrapperSpecification extends DDSpecification {
4646
then:
4747
elem.key == KnownAddresses.REQUEST_CLIENT_IP.key
4848
elem.value == [:]
49-
iter.hasNext() == false
49+
!iter.hasNext()
5050

5151
when:
5252
iter.remove()
@@ -71,25 +71,24 @@ class DataBundleMapWrapperSpecification extends DDSpecification {
7171
thrown(UnsupportedOperationException)
7272
}
7373

74-
void 'methods other than entrySet and size are not supported'() {
74+
void 'methods other than entrySet and size are not supported: #methodName'() {
7575
when:
7676
method(mapWrapper)
7777

7878
then:
7979
thrown(UnsupportedOperationException)
8080

8181
where:
82-
method << [
83-
{ it.values() },
84-
{ it.keySet() },
85-
{ it.clear() },
86-
{ it.putAll([:]) },
87-
{ it.remove('a') },
88-
{ it.put('b', 'a') },
89-
{ it.get('a') },
90-
{ it.containsValue('b') },
91-
{ it.containsKey('a') },
92-
{ it.isEmpty() },
93-
]
82+
methodName | method
83+
"values" | { it.values() }
84+
"keySet" | { it.keySet() }
85+
"clean" | { it.clear() }
86+
"putAll" | { it.putAll([:]) }
87+
"remove" | { it.remove('a') }
88+
"put" | { it.put('b', 'a') }
89+
"get" | { it.get('a') }
90+
"containsValue" | { it.containsValue('b') }
91+
"containsKey" | { it.containsKey('a') }
92+
"empty" | { it.isEmpty() }
9493
}
9594
}

dd-java-agent/instrumentation/jakarta-rs-annotations-3/src/test/groovy/JakartaRsAnnotations3InstrumentationTest.groovy

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ class JakartaRsAnnotations3InstrumentationTest extends AgentTestRunner {
141141

142142
def "no annotations has no effect"() {
143143
setup:
144+
def obj = new Jakarta() {
145+
void call() {
146+
}
147+
}
144148
runUnderTrace("test") {
145149
obj.call()
146150
}
@@ -157,13 +161,6 @@ class JakartaRsAnnotations3InstrumentationTest extends AgentTestRunner {
157161
}
158162
}
159163
}
160-
161-
where:
162-
obj | _
163-
new Jakarta() {
164-
void call() {
165-
}
166-
} | _
167164
}
168165

169166
interface Jakarta {

0 commit comments

Comments
 (0)