Repository navigation
Add tests for logger levels and uncovered error paths - #26
Merged
Merged
Conversation
This was referenced Oct 31, 2026
Covers warning-level log formatting and deferred log filtering, a bind mount source that doesn't exist, a config file that can't be read, --new with an unusable storage directory, and a running sandbox that has no settings file.
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.
Stacked on #25.
Adds tests for lines that
make testdidn't cover and that ordinary input can reach:src/logger.rs): unit tests with an in-memory writer that check the formatting of every log level, including warnings (the onlywarn!call is instop --all, whose testsmake testskips by design), and that messages logged before the log level is known are filtered once it is.resolve.rs):--bind=/does-not-exist-…fails with "Failed to canonicalize source path".resolve.rs):--config <directory>fails with "Failed to read config file".--newwith an unusable storage directory (resolve.rs): fails with "Failed to find a suitable storage directory".settings.json(get_or_create.rs): sandboxes started before settings were recorded can still be joined.I confirmed each targeted line is hit in the coverage report.
Not covered here
Most of the remaining uncovered lines are error branches of I/O calls (
create_dir,read_dir,rename, etc.) that ordinary input can't make fail. Covering them would mean adding moreTEST_*failure hooks to the source, which I left for a separate decision.stop --all(main.rs,actions/stop.rs) is only covered by tests thatmake testskips on purpose, because they stop every sandbox on the machine.