fix(test): stabilise cross-platform test isolation - #2
Merged
Merged
Conversation
The import was unused on Windows because the only callers are inside #[cfg(unix)] blocks, producing a build warning under cargo test on windows-latest.
Both test_dry_run_shows_request and test_dry_run_no_status_on_stderr were calling ags() (raw cargo binary) instead of ags_isolated(), so they depended on shared global config state. On Windows the order of parallel test execution sometimes left no active profile in place when these tests ran, producing a 'No active profile' failure. Switching to ags_isolated() gives each test a unique AGS_HOME temp dir; the binary auto-creates a default profile there on first run.
scope_version.rs defines its own cli() helper that set AGS_NO_KEYCHAIN but not AGS_HOME, so the binary read profile state from the host machine and from whatever other parallel tests had written. On macOS runners this surfaced as 'No active profile' for test_default_contract_routes_to_admin_default_version when the test ran before any other test had set up a profile. Adds the same per-process+per-thread unique AGS_HOME pattern used by ags_isolated().
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.
Fixes a cluster of test issues that surfaced when CI started running on Windows and macOS runners, all rooted in tests sharing host config state.
Changes
ProfileConfigimport behind#[cfg(unix)]. The only callers are inside#[cfg(unix)]blocks, so the import was unused on Windows and produced anunused_importswarning.ags()toags_isolated(). They were failing intermittently on Windows when parallel test ordering left no active profile in shared~/.config/ags.cli()helper setAGS_NO_KEYCHAIN=1but notAGS_HOME, so it leaked profile state across tests and host. Added the same per-process+per-thread uniqueAGS_HOMEpattern used byags_isolated(). Failure manifested on macOS asNo active profilefortest_default_contract_routes_to_admin_default_version.