Repository navigation
docs: record the 30-second unit budget (TST-47) as not fitting - #158
Conversation
The unit run takes 69 to 86 seconds after the process tests moved out of it, with no file over 7 seconds. Pester's parallel mode reached 50 seconds at best and broke tests that share environment variables, so the budget would take fewer tests rather than faster ones.
fadwen-ai
left a comment
There was a problem hiding this comment.
The decision itself holds up. A unit run on this branch (./Tests/Invoke-Tests.ps1 -TestType Unit, PowerShell 7, Windows 11) took 86.96 s for 2,211 passed tests in 164 files, with the slowest file at 5.15 s and the contract test, Test-IntuneDeployedScript and Export-IntuneAgentDiagnostic among the three slowest. The ARM step of #157's CI run 45741900418 took about 71 s (Pester: 67.76 s). The other findings of #70 were handled in #122 and #123, so Closes #70 is right.
Three statements in the row need correcting:
- The CI split is overstated. The row says that the tests that start processes are run apart "by the build and by each CI job". Only
Build/Invoke-Build.ps1and thearm64job run them in a second run. Thetestsanddesktopjobs call./Tests/Invoke-Tests.ps1without-TestType, which runs every suite in one run (#157 says the same: "the tests and 5.1 jobs run everything already"). - The contract test mocks nothing.
Tests/Unit/Module.Contract.Tests.ps1has noMock. Its time goes to a new import of the module and toGet-Helpfor every command. So "which mock everything they reach" is not true of it. - The time breakdown fits only one run. 9 + 16 + 61 s adds up to 86 s, the slow end of "69 to 86 seconds", but the row reads as if it described every run. #157's 69 s run split as 4.1 / 14.3 / 50.2 s. Say which run the figures come from.
Out of scope: none
🤖 Generated with Claude Code
|
Round 1: 3 fixed, 0 not changed
4bb9b56 dropped the row by mistake, and c7ec32f restores it with the corrections. The diff against 🤖 Generated with Claude Code |
fadwen-ai
left a comment
There was a problem hiding this comment.
Round 2. All three round 1 findings are fixed in c7ec32f, and I have resolved their threads. The diff against main is still the one added row, and the PR description matches it.
One finding is left, and I missed it in round 1:
- The diagnostic package does not mock everything it reaches.
Tests/Unit/Public/Export-IntuneAgentDiagnostic.Tests.ps1has oneMock, ofGet-Module. The test at line 283 ('dumps the registry keys it knows') runs the command without-SkipRegistry, so it reads the machine's own HKLM keys throughGet-ItemPropertyinPrivate/Get-IslRegistryText.ps1. The other tests build real zips from fixture logs inTestDrive. Of the slowest files, only the pre-flight fits "mock everything they reach".
Out of scope: none
🤖 Generated with Claude Code
|
Round 2: 1 fixed, 0 not changed
New head 🤖 Generated with Claude Code |
fadwen-ai
left a comment
There was a problem hiding this comment.
Round 3. The round 2 finding is fixed in d5ca25d, and I have resolved its thread. Each of the three slowest files is now described by what takes its time, and the new claim about the pre-flight holds: Test-IntuneDeployedScript.Tests.ps1 mocks every Graph call through Invoke-IslGraphRequest, and only two of its tests mock Test-IntuneScript.
The whole diff against main is still one added row in docs/StandardsDecisions.md, and each of its claims matches the repository: the Integration split in Tests/Invoke-Tests.ps1, which runs split it (the build and the ARM job) and which run every suite at once (the tests and 5.1 jobs), and the measured figures. A unit run on this branch passed 2,211 tests in 86.96 s, with no file slower than 5.15 s. #157's ARM unit step took about 71 s. The PR description matches the row, and Closes #70 is right, because #122 and #123 handled #70's other findings.
Out of scope: none
🤖 Generated with Claude Code
Summary
Records TST-47, the 30-second budget for the unit tests, as "Does not fit" in
docs/StandardsDecisions.md, with the measurements behind it. Closes #70.Follows #157, which moved the tests that start processes out of the unit run.
Changes
Run.Parallelreached 50 s at best, at four or eight workers. Each worker imports the module again, in about 1 s per file. The workers also share$env:ProgramDataand other environment variables, which failed 7 to 38 tests per run.Verification
./Build/Test-MarkdownLink.ps1: 27 links checked in 10 files, none broken../Tests/Invoke-Tests.ps1 -TestType Unit -PassThruon this branch (86.3 s, 2,211 passed), from earlier runs on test: leave the tests that start processes out of the unit run #157 (69 s), and from the ARM unit step of test: leave the tests that start processes out of the unit run #157's CI (72 s).Notes