Skip to content

Add tests for logger levels and uncovered error paths - #26

Merged
anoek merged 1 commit into
resource-limitsfrom
coverage-tests
Oct 31, 2026
Merged

anoek merged 1 commit into
resource-limitsfrom
coverage-tests

Conversation

@anoek

@anoek anoek commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #25.

Adds tests for lines that make test didn't cover and that ordinary input can reach:

  • Logger (src/logger.rs): unit tests with an in-memory writer that check the formatting of every log level, including warnings (the only warn! call is in stop --all, whose tests make test skips by design), and that messages logged before the log level is known are filtered once it is.
  • Bind source that doesn't exist (resolve.rs): --bind=/does-not-exist-… fails with "Failed to canonicalize source path".
  • Unreadable config file (resolve.rs): --config <directory> fails with "Failed to read config file".
  • --new with an unusable storage directory (resolve.rs): fails with "Failed to find a suitable storage directory".
  • Running sandbox without 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 more TEST_* failure hooks to the source, which I left for a separate decision. stop --all (main.rs, actions/stop.rs) is only covered by tests that make test skips on purpose, because they stop every sandbox on the machine.

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.
@anoek
anoek merged commit bfad2f8 into main Oct 31, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant