Skip to content

fix(tests): make the pi sessionDir test use a platform-absolute path - #719

Closed
Adam-Dalloul wants to merge 1 commit into
xintaofei:mainfrom
Adam-Dalloul:fix/pi-settings-test-absolute-path
Closed

fix(tests): make the pi sessionDir test use a platform-absolute path#719
Adam-Dalloul wants to merge 1 commit into
xintaofei:mainfrom
Adam-Dalloul:fix/pi-settings-test-absolute-path

Conversation

@Adam-Dalloul

Copy link
Copy Markdown
Contributor

parsers::pi::tests::settings_json_session_dir_is_honored fails on Rust server on windows-latest, and it fails on main too (run 34542650449 at a691822), so every open PR inherits one red job.

The test hard-codes /srv/pi-sessions. session_dir_from_settings only honors an absolute sessionDir, and Path::is_absolute wants a drive or UNC prefix on Windows, so that literal is not absolute there. The gate correctly refuses it, the resolver falls back to <agent_dir>/sessions, and the assertion fails. The ~-rooted case right below it has the same problem for the same reason, it just never got to run.

The product code looks right to me, so this only changes the test: both paths now get a C: prefix when the test runs on Windows. Verified by extracting the resolver and running it here with a windows-gnu toolchain: the current form fails both cases and the new form passes, alongside the env-var and relative-path cases which were never platform dependent.

@Adam-Dalloul

Copy link
Copy Markdown
Contributor Author

Closing: c80b216 fixes this, and more thoroughly. Building the paths through a helper and serializing the JSON also covers the backslash-escape case my version would still have tripped on.

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