Skip to content

ovmm_entry: Remove need for unsafe in tests#3200

Open
smalis-msft wants to merge 2 commits intomicrosoft:mainfrom
smalis-msft:no-cli-unsafe
Open

ovmm_entry: Remove need for unsafe in tests#3200
smalis-msft wants to merge 2 commits intomicrosoft:mainfrom
smalis-msft:no-cli-unsafe

Conversation

@smalis-msft
Copy link
Copy Markdown
Contributor

This file really shouldn't need unsafe, we can just mock out the environment variable instead of actually modifying it.

@smalis-msft smalis-msft requested a review from a team as a code owner April 6, 2026 16:14
Copilot AI review requested due to automatic review settings April 6, 2026 16:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the need for unsafe in openvmm_entry CLI parsing tests by refactoring the autocache disk-spec parsing so tests can inject a cache-path value instead of mutating process-wide environment variables.

Changes:

  • Added DiskCliKind::parse_autocache(...) helper to parse autocache:[key]:<kind> given a cache path input.
  • Updated DiskCliKind’s FromStr implementation to use the new helper when parsing autocache.
  • Reworked tests to avoid std::env::set_var/remove_var and added coverage for key/no-key and missing-cache-path cases.

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.

2 participants