mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-09-04 11:15:34 +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,70 +6,26 @@
|
||||
New-PveContainerTemplate, Move-PveContainerVolume, Get-PveContainerInterface.
|
||||
|
||||
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 @(
|
||||
'Suspend-PveContainer', 'Resume-PveContainer', 'Resize-PveContainerDisk',
|
||||
'New-PveContainerTemplate', 'Move-PveContainerVolume', 'Get-PveContainerInterface'
|
||||
)) {
|
||||
$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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Suspend-PveContainer
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Suspend-PveContainer' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Suspend-PveContainer' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Suspend-PveContainer'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Suspend-PveContainer'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Suspend-PveContainer' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Suspend-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Suspend-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'VmId should be Mandatory' {
|
||||
Skip-IfMissing 'Suspend-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['VmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Suspend-PveContainer'
|
||||
{ Suspend-PveContainer -Node 'pve' -VmId 100 -Confirm:$false -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -80,45 +36,16 @@ Describe 'Suspend-PveContainer' -Tag 'Unit' {
|
||||
# Resume-PveContainer
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Resume-PveContainer' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Resume-PveContainer' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Resume-PveContainer'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Resume-PveContainer'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Resume-PveContainer' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Resume-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Resume-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'VmId should be Mandatory' {
|
||||
Skip-IfMissing 'Resume-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['VmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Resume-PveContainer'
|
||||
{ Resume-PveContainer -Node 'pve' -VmId 100 -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -129,57 +56,16 @@ Describe 'Resume-PveContainer' -Tag 'Unit' {
|
||||
# Resize-PveContainerDisk
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Resize-PveContainerDisk' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Resize-PveContainerDisk' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Resize-PveContainerDisk'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Resize-PveContainerDisk'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Resize-PveContainerDisk' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Resize-PveContainerDisk'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Resize-PveContainerDisk'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'VmId should be Mandatory' {
|
||||
Skip-IfMissing 'Resize-PveContainerDisk'
|
||||
$isMandatory = $script:Cmd.Parameters['VmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Disk should be Mandatory' {
|
||||
Skip-IfMissing 'Resize-PveContainerDisk'
|
||||
$isMandatory = $script:Cmd.Parameters['Disk'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Size should be Mandatory' {
|
||||
Skip-IfMissing 'Resize-PveContainerDisk'
|
||||
$isMandatory = $script:Cmd.Parameters['Size'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Resize-PveContainerDisk'
|
||||
{ Resize-PveContainerDisk -Node 'pve' -VmId 100 -Disk 'rootfs' -Size '+5G' -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -190,23 +76,13 @@ Describe 'Resize-PveContainerDisk' -Tag 'Unit' {
|
||||
# New-PveContainerTemplate
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'New-PveContainerTemplate' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'New-PveContainerTemplate' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'New-PveContainerTemplate'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'New-PveContainerTemplate' }
|
||||
|
||||
Context 'ShouldProcess / ConfirmImpact' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'New-PveContainerTemplate'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
It 'Should declare ConfirmImpact High' {
|
||||
Skip-IfMissing 'New-PveContainerTemplate'
|
||||
$attr = $script:Cmd.ImplementingType.GetCustomAttributes(
|
||||
[System.Management.Automation.CmdletAttribute], $false) |
|
||||
Select-Object -First 1
|
||||
@@ -214,24 +90,8 @@ Describe 'New-PveContainerTemplate' -Tag 'Unit' {
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'New-PveContainerTemplate'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'VmId should be Mandatory' {
|
||||
Skip-IfMissing 'New-PveContainerTemplate'
|
||||
$isMandatory = $script:Cmd.Parameters['VmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'New-PveContainerTemplate'
|
||||
{ New-PveContainerTemplate -Node 'pve' -VmId 100 -Confirm:$false -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -242,57 +102,16 @@ Describe 'New-PveContainerTemplate' -Tag 'Unit' {
|
||||
# Move-PveContainerVolume
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Move-PveContainerVolume' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Move-PveContainerVolume' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Move-PveContainerVolume'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Move-PveContainerVolume'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Move-PveContainerVolume' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Move-PveContainerVolume'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Move-PveContainerVolume'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'VmId should be Mandatory' {
|
||||
Skip-IfMissing 'Move-PveContainerVolume'
|
||||
$isMandatory = $script:Cmd.Parameters['VmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Volume should be Mandatory' {
|
||||
Skip-IfMissing 'Move-PveContainerVolume'
|
||||
$isMandatory = $script:Cmd.Parameters['Volume'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Storage should be Mandatory' {
|
||||
Skip-IfMissing 'Move-PveContainerVolume'
|
||||
$isMandatory = $script:Cmd.Parameters['Storage'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Move-PveContainerVolume'
|
||||
{ Move-PveContainerVolume -Node 'pve' -VmId 100 -Volume 'rootfs' -Storage 'local-lvm' -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -303,38 +122,10 @@ Describe 'Move-PveContainerVolume' -Tag 'Unit' {
|
||||
# Get-PveContainerInterface
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Get-PveContainerInterface' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Get-PveContainerInterface' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Get-PveContainerInterface'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Get-PveContainerInterface'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Get-PveContainerInterface'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'VmId should be Mandatory' {
|
||||
Skip-IfMissing 'Get-PveContainerInterface'
|
||||
$isMandatory = $script:Cmd.Parameters['VmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Get-PveContainerInterface' }
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Get-PveContainerInterface'
|
||||
{ Get-PveContainerInterface -Node 'pve' -VmId 100 -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user