test(debugger): enforce teardown process isolation#7660
Merged
Conversation
Wait for the debugger target app to exit in `afterEach` before stopping the fake agent and starting the next test. Use a bounded SIGTERM wait with a SIGKILL fallback, and fail explicitly if the child still does not exit, to prevent cross-test span leakage.
Collaborator
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Contributor
Overall package sizeSelf size: 4.89 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.6 | 81.92 kB | 816.75 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7660 +/- ##
==========================================
- Coverage 80.29% 80.07% -0.22%
==========================================
Files 738 737 -1
Lines 31897 31877 -20
==========================================
- Hits 25611 25526 -85
- Misses 6286 6351 +65 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Move robust child-process teardown into `integration-tests/helpers` as `stopProc` and use it in debugger test utils. This centralizes SIGTERM/SIGKILL shutdown handling and helps prevent cross-test leakage from lingering processes.
tlhunter
approved these changes
Mar 4, 2026
dd-octo-sts bot
pushed a commit
that referenced
this pull request
Mar 5, 2026
* test(debugger): enforce teardown process isolation Wait for the debugger target app to exit in `afterEach` before stopping the fake agent and starting the next test. Use a bounded SIGTERM wait with a SIGKILL fallback, and fail explicitly if the child still does not exit, to prevent cross-test span leakage. * test(integration): share process stop helper Move robust child-process teardown into `integration-tests/helpers` as `stopProc` and use it in debugger test utils. This centralizes SIGTERM/SIGKILL shutdown handling and helps prevent cross-test leakage from lingering processes.
Merged
juan-fernandez
pushed a commit
that referenced
this pull request
Mar 5, 2026
* test(debugger): enforce teardown process isolation Wait for the debugger target app to exit in `afterEach` before stopping the fake agent and starting the next test. Use a bounded SIGTERM wait with a SIGKILL fallback, and fail explicitly if the child still does not exit, to prevent cross-test span leakage. * test(integration): share process stop helper Move robust child-process teardown into `integration-tests/helpers` as `stopProc` and use it in debugger test utils. This centralizes SIGTERM/SIGKILL shutdown handling and helps prevent cross-test leakage from lingering processes.
crysmags
pushed a commit
that referenced
this pull request
Mar 6, 2026
* test(debugger): enforce teardown process isolation Wait for the debugger target app to exit in `afterEach` before stopping the fake agent and starting the next test. Use a bounded SIGTERM wait with a SIGKILL fallback, and fail explicitly if the child still does not exit, to prevent cross-test span leakage. * test(integration): share process stop helper Move robust child-process teardown into `integration-tests/helpers` as `stopProc` and use it in debugger test utils. This centralizes SIGTERM/SIGKILL shutdown handling and helps prevent cross-test leakage from lingering processes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What does this PR do?
It hardens debugger integration-test teardown in
integration-tests/debugger/utils.jsby waiting for the spawned target app process to fully exit before moving to the next test. The cleanup path now uses a boundedSIGTERMwait, escalates toSIGKILLif needed, and fails explicitly if the process still does not exit.Motivation
A flaky debugger integration test intermittently observed mismatched trace/span IDs, which is consistent with cross-test leakage when a previous test process is still alive long enough to flush spans into the next test’s fake agent. Enforcing strict process shutdown isolation addresses that root cause instead of relaxing assertions.
Additional Notes
The flaky failure this aims to fix: https://github.com/DataDog/dd-trace-js/actions/runs/22429024616/job/64943721888