Skip to content

Commit b152541

Browse files
bm1549claude
andcommitted
Fix race in waitForTraceCountAlive: check count before liveness
The liveness check fired before the trace count check, so a normal process exit after delivering all traces was treated as a failure. Check traceCount >= count first and return early if satisfied. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 9a554fc commit b152541

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

dd-smoke-tests/log-injection/src/test/groovy/datadog/smoketest/LogInjectionSmokeTest.groovy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,11 @@ abstract class LogInjectionSmokeTest extends AbstractSmokeTest {
358358
if (traceDecodingFailure != null) {
359359
throw traceDecodingFailure
360360
}
361+
// Check the count BEFORE liveness — the process may have exited normally
362+
// after delivering all traces, and we don't want to treat that as a failure.
363+
if (traceCount.get() >= count) {
364+
return
365+
}
361366
if (testedProcess != null && !testedProcess.isAlive()) {
362367
def lastLines = tailProcessLog(20)
363368
throw new AssertionError(

0 commit comments

Comments
 (0)