Skip to content

Commit a0f7296

Browse files
committed
Fix flaky test on TomcatServlet3TestAsync
1 parent 352673a commit a0f7296

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

dd-java-agent/instrumentation/servlet/request-3/src/test/groovy/TomcatServlet3Test.groovy

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ abstract class TomcatServlet3Test extends AbstractServlet3Test<Tomcat, Context>
199199

200200
and:
201201
assertTraces(count) {
202+
Set<Tuple2<String, String>> loggedSpanIds = accessLogValue.loggedIds.toSet()
203+
assert loggedSpanIds.size() == count
202204
(1..count).eachWithIndex { val, i ->
203205
trace(spanCount(SUCCESS)) {
204206
sortSpansByStart()
@@ -212,9 +214,8 @@ abstract class TomcatServlet3Test extends AbstractServlet3Test<Tomcat, Context>
212214
}
213215
}
214216

215-
def (String traceId, String spanId) = accessLogValue.loggedIds[i]
216-
assert trace(i).get(0).traceId.toString() == traceId
217-
assert trace(i).get(0).spanId.toString() == spanId
217+
def ids = new Tuple2(trace(i).get(0).localRootSpan.traceId.toString(), trace(i).get(0).localRootSpan.spanId.toString())
218+
assert ids in loggedSpanIds
218219
}
219220
}
220221

0 commit comments

Comments
 (0)