Commit 6d0815a
Clean up after the orphan test whether or not it passes
What: read every recorded pid's liveness first, kill all of them, and only
then assert. Factors the `kill` call the check already made into a helper the
cleanup shares.
Why: the assertion ran per pid and aborted the test on the first survivor, so
the processes it was complaining about were exactly the ones it left behind.
They are shells spinning on `while :; do :; done` with no exit condition, so
each failing run pinned another core on the machine until someone noticed --
and the run that fails is the run where `kill_on_drop(true)` regressed, which
is precisely when nothing else is going to clean them up. Reporting a leak by
leaking is a poor trade.
Ordering matters: liveness is sampled before the kill so the verdict still
describes what `doctor` left running, and the assertion moves after it so the
cleanup cannot be skipped by an early panic.
Verified by removing `kill_on_drop(true)` again: the test still fails with
`processes [..] were still running after doctor exited`, and `ps` afterwards
shows none of them left.
Co-authored-by: Nearx-Labs <nearxlabs@nearx.com.br>1 parent 798124a commit 6d0815a
1 file changed
Lines changed: 33 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
490 | 490 | | |
491 | 491 | | |
492 | 492 | | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
498 | 505 | | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
499 | 511 | | |
500 | 512 | | |
501 | 513 | | |
| |||
512 | 524 | | |
513 | 525 | | |
514 | 526 | | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
| 527 | + | |
525 | 528 | | |
526 | 529 | | |
527 | 530 | | |
| |||
530 | 533 | | |
531 | 534 | | |
532 | 535 | | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
0 commit comments