Skip to content

docs: record the 30-second unit budget (TST-47) as not fitting - #158

Merged
fadwen merged 4 commits into
mainfrom
docs/tst-47-not-fitting
Nov 26, 2026
Merged

fadwen merged 4 commits into
mainfrom
docs/tst-47-not-fitting

Conversation

@fadwen

@fadwen fadwen commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

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

  • A TST-47 row after TST-43 in the decisions table:
    • Today the unit run takes 69 to 86 s locally and 72 s on the ARM runner, for 2,211 tests in 164 files. The 86 s run split as 9 s of discovery, 16 s of Pester overhead and 61 s of tests; the 69 s run as 4, 14 and 50 s. Before test: leave the tests that start processes out of the unit run #157 it took 157 s, and 206 s on the ARM runner.
    • No file takes more than 7 s.
    • Pester's Run.Parallel reached 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:ProgramData and other environment variables, which failed 7 to 38 tests per run.

Verification

Notes

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 fadwen-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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:

  1. 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.ps1 and the arm64 job run them in a second run. The tests and desktop jobs call ./Tests/Invoke-Tests.ps1 without -TestType, which runs every suite in one run (#157 says the same: "the tests and 5.1 jobs run everything already").
  2. The contract test mocks nothing. Tests/Unit/Module.Contract.Tests.ps1 has no Mock. Its time goes to a new import of the module and to Get-Help for every command. So "which mock everything they reach" is not true of it.
  3. 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

Comment thread docs/StandardsDecisions.md Resolved
Comment thread docs/StandardsDecisions.md Resolved
Comment thread docs/StandardsDecisions.md Resolved
@fadwen

fadwen commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

Round 1: 3 fixed, 0 not changed

  • The row no longer says every CI job splits the run. The build and the ARM job run the tagged tests in a second run; the tests and 5.1 jobs run every suite in one.
  • The "mock everything they reach" clause now covers only the pre-flight and the diagnostic package. The contract test is described by what takes its time.
  • The time breakdown names its run, with the figures for both the 86-second and the 69-second run.

4bb9b56 dropped the row by mistake, and c7ec32f restores it with the corrections. The diff against main is still one added row. New head c7ec32f.

🤖 Generated with Claude Code

@fadwen-ai fadwen-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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:

  1. The diagnostic package does not mock everything it reaches. Tests/Unit/Public/Export-IntuneAgentDiagnostic.Tests.ps1 has one Mock, of Get-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 through Get-ItemProperty in Private/Get-IslRegistryText.ps1. The other tests build real zips from fixture logs in TestDrive. Of the slowest files, only the pre-flight fits "mock everything they reach".

Out of scope: none

🤖 Generated with Claude Code

Comment thread docs/StandardsDecisions.md Resolved
@fadwen

fadwen commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

Round 2: 1 fixed, 0 not changed

  • The "mock everything they reach" clause is gone. The row now says what each of the three slowest files spends its time on.

New head d5ca25d.

🤖 Generated with Claude Code

@fadwen-ai fadwen-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

@fadwen
fadwen merged commit bd4fcfc into main Nov 26, 2026
5 checks passed
@fadwen
fadwen deleted the docs/tst-47-not-fitting branch November 26, 2026 03:25
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.

Tests reload the module in every file and run longer than the limits (TST-05, TST-47)

2 participants