refactor: make the offline Pester suite able to fail (#153) (#205)

Skip-IfMissing skipped a test whenever the cmdlet under test was absent
from the build, including the test asserting it exists. Every cmdlet
compiles into one assembly, so there is no partial-build case for it to
serve; all it did was hide a missing cmdlet. Delete the 37 copies and
every call site, and drop the residual conditional skips in the same
family (CmdExists probes, an attribute-presence skip in SdnCmdlets, a
lifecycle helper skipping on a cmdlet-name collision fixed long ago).

894 It blocks only reflected [Cmdlet] and [Parameter] attributes back at
the compiler: existence, CommandType -eq 'Cmdlet', Parameters.ContainsKey,
IsMandatory reflection, and per-file CmdletsToExport asserts for whichever
names an author remembered. Nothing reflected over the built assembly, so
a new cmdlet missing from the manifest shipped invisible. One data-driven
file replaces them: it diffs CmdletsToExport against the assembly's cmdlet
types in both directions and asserts the conventions reflection can see.

Behavioural tests are untouched: no-session errors, binding rejections,
ShouldProcess and -WhatIf, ConfirmImpact, ValidateSet and ValidateRange
values, parameter types, positions and pipeline binding.

The generated help covered 169 of 194 cmdlets. Regenerated with the repo's
own generate-help.ps1: 25 new markdown stubs, 13 existing docs picking up
parameters added in earlier waves, and a rebuilt MAML.

Co-authored-by: goodolclint-claude[bot] <323206664+goodolclint-claude[bot]@users.noreply.github.com>
This commit is contained in:
goodolclint-claude[bot]
2026-09-03 00:54:02 +00:00
committed by GitHub
parent 1f1c414632
commit 109dca657a
91 changed files with 9809 additions and 7330 deletions
@@ -14,18 +14,6 @@ BeforeAll {
}
Describe 'Connect-PveServer' {
Context 'Command existence' {
It 'Should be available after module import' {
Get-Command 'Connect-PveServer' -ErrorAction SilentlyContinue |
Should -Not -BeNullOrEmpty
}
It 'Should be a CmdletInfo (binary cmdlet)' {
(Get-Command 'Connect-PveServer').CommandType | Should -Be 'Cmdlet'
}
}
Context 'Parameter validation — required parameters' {
It 'Server should be Mandatory' {
$param = (Get-Command 'Connect-PveServer').Parameters['Server']
@@ -58,10 +46,6 @@ Describe 'Connect-PveServer' {
$script:Cmd = Get-Command 'Connect-PveServer'
}
It 'Should have a Server parameter' {
$script:Cmd.Parameters.ContainsKey('Server') | Should -BeTrue
}
It 'Should declare Server as Mandatory' {
$serverParam = $script:Cmd.Parameters['Server']
$isMandatory = $serverParam.ParameterSets.Values |
@@ -70,24 +54,12 @@ Describe 'Connect-PveServer' {
$isMandatory | Should -Not -BeNullOrEmpty
}
It 'Should have a Port parameter' {
$script:Cmd.Parameters.ContainsKey('Port') | Should -BeTrue
}
It 'Port should default to 8006' {
# Verify default via the static default-value metadata on the parameter.
$portParam = $script:Cmd.Parameters['Port']
$portParam | Should -Not -BeNullOrEmpty
}
It 'Should have a Credential parameter' {
$script:Cmd.Parameters.ContainsKey('Credential') | Should -BeTrue
}
It 'Should have an ApiToken parameter' {
$script:Cmd.Parameters.ContainsKey('ApiToken') | Should -BeTrue
}
It 'Should have a SkipCertificateCheck switch parameter' {
$script:Cmd.Parameters.ContainsKey('SkipCertificateCheck') | Should -BeTrue
$script:Cmd.Parameters['SkipCertificateCheck'].ParameterType |
@@ -113,10 +85,6 @@ Describe 'Connect-PveServer' {
$overlap | Should -BeNullOrEmpty
}
It 'Should have a TimeoutSeconds parameter' {
$script:Cmd.Parameters.ContainsKey('TimeoutSeconds') | Should -BeTrue
}
It 'TimeoutSeconds should reject negative values' {
$securePass = ConvertTo-SecureString 'hunter2' -AsPlainText -Force
$cred = [System.Management.Automation.PSCredential]::new('root@pam', $securePass)
@@ -10,18 +10,6 @@ BeforeAll {
}
Describe 'Disconnect-PveServer' {
Context 'Command existence' {
It 'Should be available after module import' {
Get-Command 'Disconnect-PveServer' -ErrorAction SilentlyContinue |
Should -Not -BeNullOrEmpty
}
It 'Should be a CmdletInfo (binary cmdlet)' {
(Get-Command 'Disconnect-PveServer').CommandType | Should -Be 'Cmdlet'
}
}
Context 'Parameter metadata' {
BeforeAll {
$script:Cmd = Get-Command 'Disconnect-PveServer'
@@ -38,10 +26,6 @@ Describe 'Disconnect-PveServer' {
# attribute is present by confirming ShouldProcess support is enabled.
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
}
It 'Should expose -Session parameter' {
$script:Cmd.Parameters.ContainsKey('Session') | Should -BeTrue
}
}
Context 'Behaviour when no session is active' {
@@ -10,18 +10,6 @@ BeforeAll {
}
Describe 'Test-PveConnection' {
Context 'Command existence' {
It 'Should be available after module import' {
Get-Command 'Test-PveConnection' -ErrorAction SilentlyContinue |
Should -Not -BeNullOrEmpty
}
It 'Should be a CmdletInfo (binary cmdlet)' {
(Get-Command 'Test-PveConnection').CommandType | Should -Be 'Cmdlet'
}
}
Context 'Parameter metadata' {
BeforeAll {
$script:Cmd = Get-Command 'Test-PveConnection'