Skip to content

fix(test): stabilise cross-platform test isolation - #2

Merged
phil-accelbyte merged 3 commits into
mainfrom
fix/windows-unused-import
May 4, 2026
Merged

phil-accelbyte merged 3 commits into
mainfrom
fix/windows-unused-import

Conversation

@phil-accelbyte

@phil-accelbyte phil-accelbyte commented May 4, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • tests/security/config_permissions.rs — gate ProfileConfig import behind #[cfg(unix)]. The only callers are inside #[cfg(unix)] blocks, so the import was unused on Windows and produced an unused_imports warning.
  • tests/functional/iam/dry_run.rs — switch both tests from raw ags() to ags_isolated(). They were failing intermittently on Windows when parallel test ordering left no active profile in shared ~/.config/ags.
  • tests/scope_version.rs — the file's own cli() helper set AGS_NO_KEYCHAIN=1 but not AGS_HOME, so it leaked profile state across tests and host. Added the same per-process+per-thread unique AGS_HOME pattern used by ags_isolated(). Failure manifested on macOS as No active profile for test_default_contract_routes_to_admin_default_version.

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().
@phil-accelbyte phil-accelbyte changed the title fix(test): gate ProfileConfig import behind cfg(unix) fix(test): stabilise cross-platform test isolation May 4, 2026
@phil-accelbyte
phil-accelbyte merged commit 25f89f5 into main May 4, 2026
5 checks passed
@phil-accelbyte
phil-accelbyte deleted the fix/windows-unused-import branch May 4, 2026 16:51
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