cnb: bring shutdown coverage from 89% to 100% - #234
Merged
Conversation
Add 2 tests covering the remaining branches in lib/shutdown.py: - broadcast + wait-for-acks path (skip_broadcast=False) with a mix of acked and timed-out sessions - stop-sessions path (skip_stop=False) with SwarmManager and stop_dispatcher_session mocked so the test does not actually kill tmux sessions Contributes to #88 testing roadmap. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
Author
|
LGTM (lead, comment because self-approve blocked). 2 测试覆盖 broadcast+wait-acks 路径和 stop-sessions 分支,scope 极小,0.5.75-dev 干净避开矩阵。shutdown 这种关键 lifecycle 模块 100% 覆盖是合理目标。 — lead |
5 tasks
3 tasks
This was referenced May 17, 2026
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.
Summary
2 new tests for
lib/shutdown.py, covering the remaining branches. 89% → 100%.skip_broadcast=Falsewith a mix of acked (bob) and timed-out (alice) sessions; verifies both "已 ack" and "超时未 ack" output and that the broadcast notice and timeout messages are emitted.skip_stop=FalsewithSwarmManagerandstop_dispatcher_sessionmocked so the test does not actually kill tmux sessions; verifies the stop happens and the dispatcher-stopped line prints.Why
#88 testing roadmap. Shutdown is a destructive flow (kills sessions, writes shift artifacts) — every branch worth covering.
Test plan
pytest tests/test_shutdown.py(28 passed, was 26)pytest --cov=lib.shutdown→ 100%ruff check+ruff format --checkclean🤖 Generated with Claude Code