Skip to content

Commit a08b93a

Browse files
authored
WIP (#10391)
What Does This Do The main fix is that test 4 now waits for its two traces before finishing. This prevents those traces from leaking into test 5. With that in place Motivation test security_response_id is not present in trace when request is not blocked is flaky on master
1 parent ebf18b1 commit a08b93a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

dd-smoke-tests/appsec/springboot/src/test/groovy/datadog/smoketest/appsec/SecurityResponseIdSmokeTest.groovy

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ class SecurityResponseIdSmokeTest extends AbstractAppSecServerSmokeTest {
241241

242242
// Verify security_response_id was NOT added to the URL
243243
assert !location.contains('security_response_id'), "security_response_id should not be added when placeholder is not present: ${location}"
244+
245+
and: 'wait for the trace to be collected'
246+
waitForTraceCount(1) == 1
244247
}
245248

246249
void 'test security_response_id format is consistent across requests'() {
@@ -284,6 +287,9 @@ class SecurityResponseIdSmokeTest extends AbstractAppSecServerSmokeTest {
284287
and: 'both follow UUID v4 format'
285288
UUID_PATTERN.matcher(securityResponseId1).matches()
286289
UUID_PATTERN.matcher(securityResponseId2).matches()
290+
291+
and: 'wait for both traces to be collected'
292+
waitForTraceCount(2) == 2
287293
}
288294

289295
void 'test security_response_id is not present in trace when request is not blocked'() {
@@ -308,13 +314,11 @@ class SecurityResponseIdSmokeTest extends AbstractAppSecServerSmokeTest {
308314
response.code() == 200
309315

310316
when: 'waiting for traces'
311-
waitForTraceCount(1)
317+
waitForTraceCount(1) == 1
312318

313319
then: 'the trace does not contain security_response_id in _dd.appsec.json'
314-
def spans = rootSpans.toList()
315-
// Find the span for the custom-headers endpoint (not greeting which other tests use)
316-
def normalSpan = spans.find { it.meta?.get('http.route') == '/custom-headers' }
317-
assert normalSpan != null, "Root span for /custom-headers endpoint not found in trace. Available spans: ${spans.collect { it.meta?.get('http.route') }}"
320+
rootSpans.size() == 1
321+
def normalSpan = rootSpans.first()
318322

319323
// When the request is not blocked, there should be no triggers at all
320324
def appsecJson = normalSpan.meta?.'_dd.appsec.json'

0 commit comments

Comments
 (0)