Skip to content

test(agent): resolve recorded executable path before comparing - #116

Open
antonyth18 wants to merge 1 commit into
prooflinedev:mainfrom
antonyth18:fix-agent-install-test-macos-symlink
Open

antonyth18 wants to merge 1 commit into
prooflinedev:mainfrom
antonyth18:fix-agent-install-test-macos-symlink

Conversation

@antonyth18

Copy link
Copy Markdown

Fixes #112

Summary

unattended_registration_preserves_settings_and_uses_the_installed_binary in tests/agent_install.rs fails on macOS because /var is a symlink to /private/var. The test resolved symlinks in its expected path with canonicalize(), but the CLI records std::env::current_exe(), which on macOS returns the path without resolving them. Both paths name the same file, so only the comparison was wrong.

This PR canonicalizes the path the CLI wrote before comparing, so both sides are resolved the same way.

The CLI itself is unchanged, as suggested in the issue. Canonicalizing in src/agent/config.rs would turn a symlinked launch path, such as one managed by a package manager, into a versioned target path that goes stale after an upgrade.

Testing

  • Reproduced the failure on main on macOS 14.5 with cargo test --locked --test agent_install.
  • With this change, all 3 tests in agent_install pass.
  • cargo fmt --check and cargo clippy --locked --all-targets -- -D warnings are clean.
  • Not run on Windows locally. canonicalize() adds a \\?\ prefix there, but it now applies to both sides of the comparison, so CI should stay green.

This branch has not been deployed

No deployments
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.

unattended_registration_preserves_settings_and_uses_the_installed_binary fails on macOS (/var vs /private/var)

1 participant