test(cli): stop the viewer when a test fails - #304
Merged
Merged
Conversation
A failing assertion in a cli_ui test unwound past `Viewer::stop`, and `std::process::Child` neither kills nor waits when it is dropped, so the `codegraph ui` server the test started outlived the test binary. Three such servers had been running for twelve hours. `Viewer` now kills and reaps its child in `Drop`, which both `stop` and the panic in `start` go through.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #304 +/- ##
=======================================
Coverage 95.05% 95.05%
=======================================
Files 197 197
Lines 108387 108387
=======================================
Hits 103023 103023
Misses 5364 5364 🚀 New features to boost your workflow:
|
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
A failing assertion in a
cli_uitest leaves itscodegraph uiserver running after the test binary exits. The test unwinds pastViewer::stop, andstd::process::Childneither kills nor waits when it is dropped. The test's temporary project is deleted on the way out, so the server keeps serving a directory that no longer exists. Three servers from one failed run during #298's development had been running for twelve hours.Viewernow kills and reaps its child inDrop.stopand the panic instartboth go through it, sostartno longer kills by hand. Passing tests behave exactly as before.Verification
A temporary probe test started a viewer and then panicked. It was not committed.
main, one server outlived the failed test (/tmp/evidence-tidy/red-probe.log).green-probe.log).Also run:
cargo test -p codegraph-rs --test cli_ui: 15 passed, and nocodegraph uiprocess is left afterwards (cli-ui.log);cargo clippy -p codegraph-rs --tests -- -D warnings;cargo fmt --all --check.🤖 Generated with Claude Code