Repository navigation
ci: cover Pester 4 and both supported Windows Server releases - #137
Merged
Merged
Conversation
The verifier picks its Invoke-Pester dialect from the version it finds on the SUT -- a PesterConfiguration object for Pester 5, loose parameters for Pester 4 -- but integration only ever ran against whatever the gallery ships, so the Pester 4 branch was never executed end to end. Adds a `pester4` suite to kitchen.windows.yml that pins the install with MaximumVersion, and a matching test folder whose first assertion is that it really did run under Pester 4. Because `Import-Module Pester` resolves to the highest version on PSModulePath, the workflow removes the runner's pre-installed Pester 5 for that suite and fails the step if any is left. Also matrixes the run over windows-2022 and windows-2025 rather than windows-latest alone, and narrows the Ruby dimension to the gemspec floor and the current release -- the unit job in lint.yml still covers the versions in between -- so the job count stays reasonable. Signed-off-by: Tim Smith <tim@mondoo.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Integration on this repo is already real — it stands up WinRM on the runner and drives
kitchen verifyagainst it. What it does not do is cover the branch that most needs covering.#invoke_pester_scriptblockemits two different dialects, chosen on the SUT from the version it finds:Integration only ever ran whatever Pester the gallery currently ships, so the Pester 4 half — the
Get-Command Invoke-Pesterparameter intersection,New-PesterOption,OutputFormat NUnitXml— has never actually executed in CI.What this adds
pester4suite inkitchen.windows.yml, pinned withpester_install.MaximumVersion, plustests/integration/pester4/. Its assertions match the default suite's, written to the syntax Pester 4 and 5 share, and the first one asserts the run really happened under Pester 4 — a pin that quietly stopped working would otherwise just re-test the Pester 5 path.Import-Module Pestertakes the highest version onPSModulePath, so without this the pin has no effect. The step throws if any Pester 5 survives, so a failure points at the setup rather than at a confusing assertion later.windows-2022andwindows-2025instead ofwindows-latestalone.lint.ymlstill runs the unit specs on 3.1, 3.4 and 4.0, so nothing is lost, and 2 suites x 2 OSes x 2 Rubies keeps this at 8 jobs rather than 18.windows-latest->windows, since the runner version is now the matrix's job. Instances aredefault-windowsandpester4-windows, and results are uploaded per matrix cell.Note the repeated defaults in the
pester4suite'spester_install. That key is replaced wholesale rather than merged, so pinningMaximumVersionalone would silently dropSkipPublisherCheck,ForceandErrorAction, and the install would fail against the in-box Pester 3.4.0.CONTRIBUTING.mdis updated to describe both suites and how to run them against your own Windows box.Verification
Locally, the config resolves and the new PowerShell parses:
The workflow itself can only be proven by running it, which this PR does.