From 0928ab4a11f0550c681f62be3609f5ed18d66cbc Mon Sep 17 00:00:00 2001 From: Claudio Mendes Date: Tue, 6 Oct 2026 22:00:43 +0200 Subject: [PATCH] Upgrade test stack to Pester 6.2.0 Pester 6 no longer falls through unmatched mocks to the real command, so the filtered New-Object mocks in Tests/Runtime.Tests.ps1 broke the LDAP connection tests. Add explicit unfiltered default mocks that forward -TypeName and -ArgumentList to the real cmdlet; this is green under both Pester 5.7.1 and 6.2.0. Bump every Pester version pin (validator, both workflows, PR template, validation docs) and regenerate CHECKSUMS.txt. No production script, VERSION, CHANGELOG or release-notes changes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/pull_request_template.md | 2 +- .github/workflows/ci.yml | 4 ++-- .github/workflows/release.yml | 4 ++-- CHECKSUMS.txt | 12 ++++++------ Tests/Runtime.Tests.ps1 | 10 ++++++++++ build/Invoke-Validation.ps1 | 2 +- docs/validation.md | 4 ++-- 7 files changed, 24 insertions(+), 14 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index bc5ab46..8911f80 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,7 +6,7 @@ Describe the change and why it is needed. - [ ] `build\Invoke-Validation.ps1` passes on Windows PowerShell 5.1 - [ ] PSScriptAnalyzer returns no findings -- [ ] Pester 5.7.1 discovery and tests pass +- [ ] Pester 6.2.0 discovery and tests pass - [ ] Full validation runs without `-SkipChecksums`; manifest matches worktree and candidate `git archive` - [ ] Live results are recorded separately, with untested scenarios explicitly pending - [ ] Documentation updated if behavior changed diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df27892..81e2623 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,9 +16,9 @@ jobs: if (-not (Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue)) { Register-PSRepository -Default } - Install-Module Pester -RequiredVersion '5.7.1' -Repository PSGallery -Scope CurrentUser -Force + Install-Module Pester -RequiredVersion '6.2.0' -Repository PSGallery -Scope CurrentUser -Force Install-Module PSScriptAnalyzer -RequiredVersion '1.25.0' -Repository PSGallery -Scope CurrentUser -Force - Import-Module Pester -RequiredVersion '5.7.1' -Force + Import-Module Pester -RequiredVersion '6.2.0' -Force Import-Module PSScriptAnalyzer -RequiredVersion '1.25.0' -Force $ValidationParameters = @{} if ($env:GITHUB_REF -like 'refs/tags/*') { diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f432532..07282b0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,9 +32,9 @@ jobs: if (-not (Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue)) { Register-PSRepository -Default } - Install-Module Pester -RequiredVersion '5.7.1' -Repository PSGallery -Scope CurrentUser -Force + Install-Module Pester -RequiredVersion '6.2.0' -Repository PSGallery -Scope CurrentUser -Force Install-Module PSScriptAnalyzer -RequiredVersion '1.25.0' -Repository PSGallery -Scope CurrentUser -Force - Import-Module Pester -RequiredVersion '5.7.1' -Force + Import-Module Pester -RequiredVersion '6.2.0' -Force Import-Module PSScriptAnalyzer -RequiredVersion '1.25.0' -Force - name: Validate tagged revision diff --git a/CHECKSUMS.txt b/CHECKSUMS.txt index 675ebb6..b22e7c1 100644 --- a/CHECKSUMS.txt +++ b/CHECKSUMS.txt @@ -1,8 +1,11 @@ 0081369829B1FA8F614C1CB4760BD9037C1CD086057859067CE1A0D7337518E9 assets/addgroup-flow.svg +02ED8921F7A4E0D1AE3A427A21F69CB37A2B601382EA077AE5CD39283BCFC82A .github/workflows/release.yml 0657B1B63EF66323CB7C40E15C9C677044AE8A3D2F582DFC93E4362FFF147433 .github/ISSUE_TEMPLATE/bug_report.yml 10404ED6CCE0A3B32DC8AB2F3819D4D11A6E68B2FCBC5E57BBB6B31985BD0A78 examples/README.md 124B4BB47049E1202737959B05F0F38AF1EE76933CBD98678B3D43BBE46F19B3 Tests/Documentation.Tests.ps1 +138F57999326DBE0082CE1188AFCA2E6AB72FC38D597D42E05C9AD179B9D95EC docs/validation.md 1ED4E3E647F752AD7D7CAFC8E3D4074612593ED9AD21B9B66B96BAD4266211B0 build/Update-Banners.ps1 +211B1889B15D97E6D213E009663BADA6E8C0DC50A8F8C647A23FE17A34231947 .github/pull_request_template.md 224211994D4D897F9E750FB82F0971DC6D0A91E0DD4B6FCC2649B15C464A7027 docs/deployment.md 229B99CB364794905604F3DF1AF743818B87BEF3285AEA2D8F9E2EF7110BEBE6 LICENSE 22D6D77DC30B753FC74E513EFE398EF4DA6E8A6AE62D0D3DE0C922F03A1ABC75 .github/CODEOWNERS @@ -10,7 +13,6 @@ 2E2102953B196CE96FA75D81444AF56E3A249A5E5B07C9FB181F65BC0DB09489 .editorconfig 33E160714B21F67E4CF6A4758756277A6DB8EFA7F5FD181A1176C1D159B7D2C4 _layouts/default.html 35388D74DC4D7174B5AC058CCE5FB512C88240DF4DB086EE0A81C9AFA3613717 .vscode/tasks.json -39A11C28691FD5D5C244D143B6338B03F350725C863AAEFBDF123EB297BA9B75 build/Invoke-Validation.ps1 3A844B374BDB13EAFC32E96ACD1562E463BC740867741CCA374B086C65F90D4F .gitattributes 3FE2E5ADAC434532630E6CB437E590D7C022269CD68C8FF616C15D31B49BF57E examples/contoso-task-sequence.md 4CB8113CA071C23E75348CED37CBA752DF9994FBBE0A2D4312CC03A4CE8C0543 RELEASE-NOTES.md @@ -23,22 +25,21 @@ 5F1058D7A1B72D2A5E565F5936D21B417DB3E55A839700110B41B80BCA50805B docs/release-process.md 61E3F937BE96C02DD220060E2F3D5A79FA0215D651892F52228A75A638950139 docs/distribution.md 6297B77EB5E5EEB5449B91762B9073A195BDD058ECA919769C816168DE7A0691 .github/ISSUE_TEMPLATE/config.yml -6505199FA105CAED7E421DE684DE8088034382E77C2F40FDB1673B94FE5FE35B .github/workflows/ci.yml 670ABB6E09B7A198A30361A18A4C0372FC11F58D9C109BB74F86F2C29D8ECD1F assets/css/style.scss 69BC45DC42B9ACB96A69823ADBC6AE538374E3C0BDE169B855B32C48EAAEF52F assets/fluentui-LICENSE.txt 6F255CD182D60581CAAC0CE468C47C32A26A9A1034EAED66031CF728412A908A Tests/Branding.Tests.ps1 71E407509F8C03D88B17B89569E219E103A48192A128D4638EB1C47D02A46134 Tests/Validation.Tests.ps1 72870C0C33C404D73379A4C3FBEFF0C974317D671397C4F9E3E0EBE4491677E1 assets/branding.json 75266144117366780503A498D1B14257A8B79B80DEE83D996F8202FBE903C24F CHANGELOG.md +7B0262B921E17C94EB41D4F1EB25ABC46F12AE08F35052502D01046B1124C6AB build/Invoke-Validation.ps1 7C35ABD79FE1F5346C10969D7F5CD0DEDF5D2CE3850D997AE3A3DB387FBFD565 CODE_OF_CONDUCT.md 7C48241074306AA35FF34F2E4C313B993ADA30A1033085D2D9CD00766908825F assets/README.md 7D89ABE8E3D807012982C18155FA81F7FC4315556F37250883D54859B295E715 _config.yml 8946F63BA3FE8182DF6BFDB1DAEECAFDCD02677EFDDB9B15D98108379BA9748D Scripts/Add-ComputerToADGroup.ps1 -8F8586B394762C5881C1220DF3959D967DF6AC375286D2F4F61EF551F2EB587D Tests/Runtime.Tests.ps1 +99A247375B9F74E964779CEB8EB8006EC21A252977A763F37EB158B86DF1C6AD .github/workflows/ci.yml 99D0818971B014847E1EED2303AC76D88216B010E6B3D5E71E3411BBE670E909 AUTHORS.md 9C069DC1A798FD578D45295CE3CB502B39ED5693C7F282EE45646E396E563A21 assets/people-team.svg A047D4BF5DC341B6E460F0D3EABD52AA884ED92F0EE5A2B86847B3AEB3486609 assets/folder-arrow-right.svg -A16476A9193E48D0FDCA1EBE182F0F6CA2EA68D34355B3AD35C619F24008C4E9 docs/validation.md A6C22D28A2041CEF448BA7650FB84E61092314BB3850FCF5B58AA42E49A16160 examples/git-configuration.md A996D56F8BC4CDC5AC325D5322EC6577014CCA28E89DCD6E654CBAE2C464970E assets/validation-pass.svg AE0EBC700A81F090A59935F13672E9109DE6616D49E8FADC36003028DEB94202 docs/development.md @@ -50,14 +51,13 @@ BC9A48CF4EBBB19C8EA2365ECBF619F8135A62A425F068C5108A3FC960D86FBC docs/architect BF528DC4807B5CD45B9513F4154551F3BD8BFDAD9BB4BA12A80C3FCBB7283063 .vscode/extensions.json C189205DC2540C487F59A1B647F648A256B6A86919D73CF818F48AFC95A1A891 assets/addgroup-flow-compact.svg C69B1EA2320002999BF30BF6C612C7A2346F3FEB7BF48A760DD20C29FE2A94AD assets/task-sequence-flow-compact.svg -C924A6CB0765CD80B4BF0DCDD989A8B128751048EBB9DC23CC0FCF76817EC18D .github/workflows/release.yml D2BAFF7071DF4636D064D17C70D2BF4559DADDBA302848A769E97DAF5033AC7A README.md D52119CD9D85F9211A078959331CF7C3304AEBC11D1900D3ECAF67AFDFF9AA37 Tests/Distribution.Tests.ps1 D750D8FF626BF07997B2BD9D53891A9771C28E4C7F648F1FC51779D1A2CB1AA1 assets/banner-compact.svg D7B93854B2CDFEF92CB6A5F23A047092C8CEA9E27F764A1C71DBA37BE44972CA .github/ISSUE_TEMPLATE/feature_request.yml +DDABD4456279819386271EF9B605F69666F77EF56CCC67525352226C5FF783F1 Tests/Runtime.Tests.ps1 DF3A074261544800B739DEE93B071DE5383EFE796B874D7673AD69A5548F7A4A .github/FUNDING.yml E49B0BAD89C4CAF2A07BB3FA625FF431977115A81A39B455061E96534BE291A0 .github/dependabot.yml EA3E0EBA3F113DF27D462166E7065CD761167531E53ED031FE6B820E0C91AC60 assets/banner.svg -EFB5564544D49377DC1DACC2970D445FDCBC5E689DA7B4E5501267549622E2E2 .github/pull_request_template.md F3DEABC14B566A687506BFC3079BB44F999A52A28E29741A8CC9777B6239D378 docs/compatibility.md FD729F46D373707A9228AB503733014BA8DA4C6B36AFB38FA87FE369A6F3FCFA Tests/Repository.Tests.ps1 diff --git a/Tests/Runtime.Tests.ps1 b/Tests/Runtime.Tests.ps1 index 780d400..3266c42 100644 --- a/Tests/Runtime.Tests.ps1 +++ b/Tests/Runtime.Tests.ps1 @@ -398,6 +398,11 @@ Describe 'LDAP connection security' { $Secret = [Security.SecureString]::new() foreach ($Character in 'test-only-password'.ToCharArray()) { $Secret.AppendChar($Character) } $script:TestCredential = [pscredential]::new('CONTOSO\test-account', $Secret) + Mock New-Object { + $Real = Get-Command New-Object -CommandType Cmdlet + if ($null -eq $ArgumentList) { & $Real -TypeName $TypeName } + else { & $Real -TypeName $TypeName -ArgumentList $ArgumentList } + } Mock New-Object { $script:Identifier = $ArgumentList[0] $script:Connection @@ -626,6 +631,11 @@ Describe 'Orchestration with mocked Task Sequence and LDAP boundaries' { } It 'releases the secure password if credential construction fails' -Tag 'ResourceDisposal' { + Mock New-Object { + $Real = Get-Command New-Object -CommandType Cmdlet + if ($null -eq $ArgumentList) { & $Real -TypeName $TypeName } + else { & $Real -TypeName $TypeName -ArgumentList $ArgumentList } + } Mock New-Object { $script:ObservedSecurePassword = $ArgumentList[1] throw [ArgumentException]::new('Test credential construction failure.') diff --git a/build/Invoke-Validation.ps1 b/build/Invoke-Validation.ps1 index 961e414..6c9b3c5 100644 --- a/build/Invoke-Validation.ps1 +++ b/build/Invoke-Validation.ps1 @@ -24,7 +24,7 @@ try { throw 'Validation requires Windows PowerShell 5.1 (powershell.exe).' } - Import-Module Pester -RequiredVersion 5.7.1 -ErrorAction Stop + Import-Module Pester -RequiredVersion 6.2.0 -ErrorAction Stop Import-Module PSScriptAnalyzer -RequiredVersion 1.25.0 -ErrorAction Stop $Root = Split-Path -Parent $PSScriptRoot $Files = @(Get-ChildItem -LiteralPath $Root -Force | Where-Object { $_.Name -ne '.git' } | diff --git a/docs/validation.md b/docs/validation.md index 194d88c..ac4923d 100644 --- a/docs/validation.md +++ b/docs/validation.md @@ -10,7 +10,7 @@ title: Validation [Open the full-size checklist](../assets/validation-pass.svg). The illustration summarizes the validation layers; use the results and checklist below when planning a rollout. -The v1.0.0 source passes Windows PowerShell 5.1 parser checks, PSScriptAnalyzer 1.25.0, Pester 5.7.1, and exact-byte source manifest verification. Runtime tests bind the production parameters and use mocked Task Sequence, domain-discovery, and LDAP boundaries. They cover escaped requests, membership verification, exception classification, failover, bounded retries, duplicate groups, resource disposal, and credential-free diagnostics. +The source passes Windows PowerShell 5.1 parser checks, PSScriptAnalyzer 1.25.0, Pester 6.2.0, and exact-byte source manifest verification. Runtime tests bind the production parameters and use mocked Task Sequence, domain-discovery, and LDAP boundaries. They cover escaped requests, membership verification, exception classification, failover, bounded retries, duplicate groups, resource disposal, and credential-free diagnostics. **Live ConfigMgr and Active Directory testing was not executed.** Automated results do not establish live authentication, certificate trust, permissions, or deployment compatibility. @@ -19,7 +19,7 @@ The v1.0.0 source passes Windows PowerShell 5.1 parser checks, PSScriptAnalyzer Use the same pinned development modules as CI. If the required versions are missing, install them through your organization's approved package source and trust policy; retain publisher verification: ```powershell -Install-Module Pester -RequiredVersion '5.7.1' -Repository PSGallery -Scope CurrentUser -Force +Install-Module Pester -RequiredVersion '6.2.0' -Repository PSGallery -Scope CurrentUser -Force Install-Module PSScriptAnalyzer -RequiredVersion '1.25.0' -Repository PSGallery -Scope CurrentUser -Force ```