Skip to content

fix(templates): name static tests by package and use the device 64-bit host - #39

Merged
fadwen merged 2 commits into
fix/gate-ci-templatefrom
fix/suite-template
Oct 14, 2026
Merged

fadwen merged 2 commits into
fix/gate-ci-templatefrom
fix/suite-template

Conversation

@fadwen

@fadwen fadwen commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

Two defects in Examples/IntuneScripts.Tests.ps1.template and one wrong comment in the repository's own gate workflow, found by running the template against a demo repository on a Windows on ARM machine and reading the hosted runner's logs.

  • The static tests were named <_.Name>, so every remediation's detection became a test called Detect.ps1, and the Pester output could not say which package failed.
  • The WOW64 comparison asked for -Architecture x64 outright. Windows on ARM has no x64 host and refuses it, so the test failed on that device for every remediation; the agent runs the native 64-bit host there.
  • quality-gates.yml said the hosted runner is elevated and the SYSTEM-context tests run in CI. The latest gate run shows them skipped in both Windows jobs (SystemContext.Tests.ps1 finished in 76 ms, every test skipped): the runner's token does not pass IsInRole(Administrator). The suite template's own comment, which says those tests are skipped on a hosted runner, was right.

Changes

  • Examples/IntuneScripts.Tests.ps1.template: the static tests are named <_.Directory.Name>/<_.Name>; BeforeAll works out the device's 64-bit host (x64, or arm64 on Windows on ARM) as $script:Host64, and the WOW64 test uses it.
  • .github/workflows/quality-gates.yml: the comment on the Windows PowerShell job says the SYSTEM-context tests skip on the hosted runner, and why.
  • CHANGELOG.md: Fixed entry under Unreleased.

Verification

  • The template run against the demo repository on this ARM64 machine, unelevated: 9 passed, 2 failed (the two deliberate static findings), 6 skipped (SYSTEM, install and requirement tests); before the change the two WOW64 tests failed with "No x64 PowerShell host on this Arm64 device". The names read Report-Uptime/Detect.ps1.
  • No line over 115 characters in the template.

Notes

  • Stacked on the gate fix (fix/gate-ci-template); merge that first.

…t host

The suite template named its static tests after the file alone, so every
remediation detection was a test called Detect.ps1 and the output could not
say which package failed; the folder is part of the name now. Its WOW64
comparison asked for -Architecture x64 outright, which Windows on ARM
refuses; it runs the device own 64-bit host, as the commands default to
since 0.30.0.

The gate workflow comment claimed the hosted runner is elevated and the
SYSTEM-context tests run in CI; the latest run shows them skipped in both
Windows jobs, so the comment says so.

@fadwen fadwen left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Notes on the lines whose reason the diff does not show.

$script:IsAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).
IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
# The device's 64-bit host, for the WOW64 comparison: x64 on x64, arm64 on Windows on ARM
$script:Host64 = if ("$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)" -eq 'Arm64') {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Worked out in the suite rather than taken from the module because the helper that does it (Get-IslHostArchitecture) is private, and the remediation commands default to x86, the portal default for remediations, so the 64-bit host has to be named here. Invoke-IntuneDetectionTest would have defaulted to it on its own.

}

It 'Win32 detection scripts survive the stdout/stderr rules: <_.Name>' -AllowNullOrEmptyForEach -ForEach (
It 'survives the stdout/stderr rules: <_.Directory.Name>/<_.Name>' -AllowNullOrEmptyForEach -ForEach (

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

The name lost its 'Win32 detection scripts' prefix to stay within the line limit once the folder went into the template; Widget/Detect.ps1 under the Win32 folder says which script it is.

# The integration suite as well: it launches the 5.1 hosts the harness uses on a device,
# and the runner is elevated, so the SYSTEM-context tests run here as they do under pwsh
# The integration suite as well: it launches the 5.1 hosts the harness uses on a device.
# The hosted runner's token is not elevated (IsInRole Administrator is false), so the

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Read from the run 38500718603 logs: SystemContext.Tests.ps1 took 76 ms in this job and every test in it is marked skipped in the pwsh job, which only happens when IsInRole(Administrator) is false. The hosted runner's runneradmin account is in Administrators but the process holds the filtered token. No behaviour changes; the comment was the only thing wrong.

@fadwen
fadwen merged commit 7aaaed9 into fix/gate-ci-template Oct 14, 2026
3 of 4 checks passed
@fadwen
fadwen deleted the fix/suite-template branch October 14, 2026 15:58
@fadwen fadwen mentioned this pull request Oct 15, 2026
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