mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-09-03 18:55:33 +00:00
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:
committed by
GitHub
parent
1f1c414632
commit
109dca657a
@@ -6,57 +6,20 @@
|
||||
Start-PveNodeVms, Stop-PveNodeVms.
|
||||
|
||||
All tests are fully offline — no live Proxmox VE target is required.
|
||||
If a cmdlet is not yet compiled the test is marked Skipped.
|
||||
#>
|
||||
|
||||
BeforeAll {
|
||||
. $PSScriptRoot/../_TestHelper.ps1
|
||||
|
||||
$script:Availability = @{}
|
||||
foreach ($name in @(
|
||||
'Get-PveNodeConfig', 'Set-PveNodeConfig', 'Get-PveNodeDns', 'Set-PveNodeDns',
|
||||
'Start-PveNodeVms', 'Stop-PveNodeVms'
|
||||
)) {
|
||||
$script:Availability[$name] = $null -ne (Get-Command $name -ErrorAction SilentlyContinue)
|
||||
}
|
||||
|
||||
function Skip-IfMissing([string]$Name) {
|
||||
if (-not $script:Availability[$Name]) {
|
||||
Set-ItResult -Skipped -Because "$Name is not yet implemented in this build"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Get-PveNodeConfig
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Get-PveNodeConfig' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Get-PveNodeConfig' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Get-PveNodeConfig'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Get-PveNodeConfig'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Get-PveNodeConfig'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Get-PveNodeConfig' }
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Get-PveNodeConfig'
|
||||
{ Get-PveNodeConfig -Node 'pve' -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -67,39 +30,16 @@ Describe 'Get-PveNodeConfig' -Tag 'Unit' {
|
||||
# Set-PveNodeConfig
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Set-PveNodeConfig' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveNodeConfig' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Set-PveNodeConfig'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Set-PveNodeConfig'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveNodeConfig' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Set-PveNodeConfig'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Set-PveNodeConfig'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Set-PveNodeConfig'
|
||||
{ Set-PveNodeConfig -Node 'pve' -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -110,32 +50,10 @@ Describe 'Set-PveNodeConfig' -Tag 'Unit' {
|
||||
# Get-PveNodeDns
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Get-PveNodeDns' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Get-PveNodeDns' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Get-PveNodeDns'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Get-PveNodeDns'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Get-PveNodeDns'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Get-PveNodeDns' }
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Get-PveNodeDns'
|
||||
{ Get-PveNodeDns -Node 'pve' -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -146,45 +64,16 @@ Describe 'Get-PveNodeDns' -Tag 'Unit' {
|
||||
# Set-PveNodeDns
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Set-PveNodeDns' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveNodeDns' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Set-PveNodeDns'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Set-PveNodeDns'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveNodeDns' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Set-PveNodeDns'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Set-PveNodeDns'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Search should be Mandatory' {
|
||||
Skip-IfMissing 'Set-PveNodeDns'
|
||||
$isMandatory = $script:Cmd.Parameters['Search'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Set-PveNodeDns'
|
||||
{ Set-PveNodeDns -Node 'pve' -Search 'example.com' -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -195,39 +84,16 @@ Describe 'Set-PveNodeDns' -Tag 'Unit' {
|
||||
# Start-PveNodeVms
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Start-PveNodeVms' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Start-PveNodeVms' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Start-PveNodeVms'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Start-PveNodeVms'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Start-PveNodeVms' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Start-PveNodeVms'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Start-PveNodeVms'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Start-PveNodeVms'
|
||||
{ Start-PveNodeVms -Node 'pve' -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -238,23 +104,13 @@ Describe 'Start-PveNodeVms' -Tag 'Unit' {
|
||||
# Stop-PveNodeVms
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Stop-PveNodeVms' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Stop-PveNodeVms' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Stop-PveNodeVms'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Stop-PveNodeVms' }
|
||||
|
||||
Context 'ShouldProcess / ConfirmImpact' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Stop-PveNodeVms'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
It 'Should declare ConfirmImpact High' {
|
||||
Skip-IfMissing 'Stop-PveNodeVms'
|
||||
$attr = $script:Cmd.ImplementingType.GetCustomAttributes(
|
||||
[System.Management.Automation.CmdletAttribute], $false) |
|
||||
Select-Object -First 1
|
||||
@@ -262,18 +118,8 @@ Describe 'Stop-PveNodeVms' -Tag 'Unit' {
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Stop-PveNodeVms'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Stop-PveNodeVms'
|
||||
{ Stop-PveNodeVms -Node 'pve' -Confirm:$false -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user