Repository navigation
fix(templates): name static tests by package and use the device 64-bit host - #39
Conversation
…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
left a comment
There was a problem hiding this comment.
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') { |
There was a problem hiding this comment.
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 ( |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
Summary
Two defects in
Examples/IntuneScripts.Tests.ps1.templateand 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.<_.Name>, so every remediation's detection became a test calledDetect.ps1, and the Pester output could not say which package failed.-Architecture x64outright. 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.ymlsaid 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.ps1finished in 76 ms, every test skipped): the runner's token does not passIsInRole(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>;BeforeAllworks out the device's 64-bit host (x64, orarm64on 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
Report-Uptime/Detect.ps1.Notes
fix/gate-ci-template); merge that first.