Make CLI doctor tests hermetic (isolate state_dir/cache_dir)#75
Merged
Conversation
Summary
give the doctor CLI tests isolated `state_dir`/`cache_dir` so they stop
reading the live machine's classifier stamps and index cache.
`write_data_config` (and two inline doctor-test configs) set only
`data_dir`, so `state_dir`/`cache_dir` fell back to
`${XDG_STATE_HOME:-~/.local/state}` / `${XDG_CACHE_HOME:-~/.cache}`.
`doctor` reads those (classifier stamps, scoped index), so on any
machine with real hive-memory state the tests saw extra warnings and
failed — machine-dependent results.
- `write_data_config` now writes `state_dir`/`cache_dir` under the
config's temp dir, mirroring `write_config`
- convert the `doctor-project-binding` inline config to reuse
`write_data_config`
- add `state_dir`/`cache_dir` to the two remaining doctor inline configs
(`doctor-manifest-permissions`, `doctor-agent-broad-access`)
Testing
- cargo test --test cli: 137 passed, 0 failed (previously the doctor
tests failed on this machine, which has live classifier state)
- cargo fmt --check clean; cargo clippy --test cli -- -D warnings clean
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
Give the doctor CLI tests isolated
state_dir/cache_dirso they stopreading the live machine's classifier stamps and index cache.
write_data_config(and two inline doctor-test configs) set onlydata_dir, sostate_dir/cache_dirfell back to${XDG_STATE_HOME:-~/.local/state}/${XDG_CACHE_HOME:-~/.cache}.doctorreads those (classifier stamps and the scoped index), so on anymachine with real hive-memory state the tests saw extra warnings and
failed with machine-dependent results.
write_data_confignow writesstate_dir/cache_dirunder theconfig's temp dir, mirroring
write_configdoctor-project-bindinginline config to reusewrite_data_configstate_dir/cache_dirto the two remaining doctor inline configs(
doctor-manifest-permissions,doctor-agent-broad-access)Test-only change.
Testing
cargo test --test cli: 137 passed, 0 failed (the doctor testspreviously failed on this machine, which has live classifier state)
cargo fmt --checkcleancargo clippy --test cli --all-features -- -D warningsclean