Commit 3dfbca9
committed
test(run[deadline]) Cover SIGKILL-didn't-reap warning path
why: ``_terminate_process`` emits a WARNING when a child resists both
``SIGTERM`` and ``SIGKILL`` (i.e. the second ``proc.wait`` raises
``TimeoutExpired`` and the final ``poll()`` still reports the child
alive). Reproducing that state with a real subprocess requires a
``D``-state child or kernel fixtures, so the path was uncovered --
correct by inspection only. With downstream operators relying on the
log record to triage zombie risk, "correct by inspection" isn't
enough.
what:
- Add ``test_terminate_process_warns_when_sigkill_does_not_reap``
using ``unittest.mock.MagicMock(spec=subprocess.Popen)`` -- ``poll``
always reports alive, ``wait`` always raises ``TimeoutExpired``,
so both ``_terminate_process`` branches fire and the WARNING is
emitted with the canonical ``vcs_cmd`` extra.
- Asserts the warning level, the message substring, the ``vcs_cmd``
extra value, and that ``terminate()`` and ``kill()`` were each
called once -- enough to detect a regression that swallows the
log or skips the second wait.1 parent bc5af2c commit 3dfbca9
1 file changed
Lines changed: 45 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
256 | 257 | | |
257 | 258 | | |
258 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
259 | 304 | | |
260 | 305 | | |
261 | 306 | | |
| |||
0 commit comments