mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-09-04 03:05:32 +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,64 +6,26 @@
|
||||
Set-PveSdnIpam, Set-PveSdnDns, Invoke-PveSdnApply, Set-PveRole, Set-PveApiToken.
|
||||
|
||||
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 @(
|
||||
'Set-PveSdnZone', 'Set-PveSdnVnet', 'Set-PveSdnSubnet', 'Set-PveSdnController',
|
||||
'Set-PveSdnIpam', 'Set-PveSdnDns', 'Invoke-PveSdnApply', 'Set-PveRole', 'Set-PveApiToken'
|
||||
)) {
|
||||
$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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Set-PveSdnZone
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Set-PveSdnZone' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveSdnZone' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Set-PveSdnZone'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Set-PveSdnZone'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveSdnZone' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Set-PveSdnZone'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Zone should be Mandatory' {
|
||||
Skip-IfMissing 'Set-PveSdnZone'
|
||||
$isMandatory = $script:Cmd.Parameters['Zone'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Set-PveSdnZone'
|
||||
{ Set-PveSdnZone -Zone 'testzone' -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -74,39 +36,16 @@ Describe 'Set-PveSdnZone' -Tag 'Unit' {
|
||||
# Set-PveSdnVnet
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Set-PveSdnVnet' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveSdnVnet' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Set-PveSdnVnet'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Set-PveSdnVnet'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveSdnVnet' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Set-PveSdnVnet'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Vnet should be Mandatory' {
|
||||
Skip-IfMissing 'Set-PveSdnVnet'
|
||||
$isMandatory = $script:Cmd.Parameters['Vnet'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Set-PveSdnVnet'
|
||||
{ Set-PveSdnVnet -Vnet 'testvnet' -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -117,45 +56,16 @@ Describe 'Set-PveSdnVnet' -Tag 'Unit' {
|
||||
# Set-PveSdnSubnet
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Set-PveSdnSubnet' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveSdnSubnet' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Set-PveSdnSubnet'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Set-PveSdnSubnet'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveSdnSubnet' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Set-PveSdnSubnet'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Vnet should be Mandatory' {
|
||||
Skip-IfMissing 'Set-PveSdnSubnet'
|
||||
$isMandatory = $script:Cmd.Parameters['Vnet'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Subnet should be Mandatory' {
|
||||
Skip-IfMissing 'Set-PveSdnSubnet'
|
||||
$isMandatory = $script:Cmd.Parameters['Subnet'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Set-PveSdnSubnet'
|
||||
{ Set-PveSdnSubnet -Vnet 'testvnet' -Subnet '10.0.0.0/24' -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -166,39 +76,16 @@ Describe 'Set-PveSdnSubnet' -Tag 'Unit' {
|
||||
# Set-PveSdnController
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Set-PveSdnController' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveSdnController' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Set-PveSdnController'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Set-PveSdnController'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveSdnController' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Set-PveSdnController'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Controller should be Mandatory' {
|
||||
Skip-IfMissing 'Set-PveSdnController'
|
||||
$isMandatory = $script:Cmd.Parameters['Controller'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Set-PveSdnController'
|
||||
{ Set-PveSdnController -Controller 'testctrl' -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -209,39 +96,16 @@ Describe 'Set-PveSdnController' -Tag 'Unit' {
|
||||
# Set-PveSdnIpam
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Set-PveSdnIpam' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveSdnIpam' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Set-PveSdnIpam'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Set-PveSdnIpam'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveSdnIpam' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Set-PveSdnIpam'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Ipam should be Mandatory' {
|
||||
Skip-IfMissing 'Set-PveSdnIpam'
|
||||
$isMandatory = $script:Cmd.Parameters['Ipam'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Set-PveSdnIpam'
|
||||
{ Set-PveSdnIpam -Ipam 'testipam' -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -252,39 +116,16 @@ Describe 'Set-PveSdnIpam' -Tag 'Unit' {
|
||||
# Set-PveSdnDns
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Set-PveSdnDns' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveSdnDns' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Set-PveSdnDns'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Set-PveSdnDns'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveSdnDns' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Set-PveSdnDns'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Dns should be Mandatory' {
|
||||
Skip-IfMissing 'Set-PveSdnDns'
|
||||
$isMandatory = $script:Cmd.Parameters['Dns'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Set-PveSdnDns'
|
||||
{ Set-PveSdnDns -Dns 'testdns' -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -295,30 +136,16 @@ Describe 'Set-PveSdnDns' -Tag 'Unit' {
|
||||
# Invoke-PveSdnApply
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Invoke-PveSdnApply' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Invoke-PveSdnApply' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Invoke-PveSdnApply'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Invoke-PveSdnApply'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Invoke-PveSdnApply' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Invoke-PveSdnApply'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Invoke-PveSdnApply'
|
||||
{ Invoke-PveSdnApply -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -329,45 +156,16 @@ Describe 'Invoke-PveSdnApply' -Tag 'Unit' {
|
||||
# Set-PveRole
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Set-PveRole' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveRole' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Set-PveRole'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Set-PveRole'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveRole' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Set-PveRole'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'RoleId should be Mandatory' {
|
||||
Skip-IfMissing 'Set-PveRole'
|
||||
$isMandatory = $script:Cmd.Parameters['RoleId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Privileges should be Mandatory' {
|
||||
Skip-IfMissing 'Set-PveRole'
|
||||
$isMandatory = $script:Cmd.Parameters['Privileges'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Set-PveRole'
|
||||
{ Set-PveRole -RoleId 'testrole' -Privileges 'VM.Audit' -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -378,45 +176,16 @@ Describe 'Set-PveRole' -Tag 'Unit' {
|
||||
# Set-PveApiToken
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Set-PveApiToken' -Tag 'Unit' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveApiToken' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Set-PveApiToken'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Set-PveApiToken'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveApiToken' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Set-PveApiToken'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'UserId should be Mandatory' {
|
||||
Skip-IfMissing 'Set-PveApiToken'
|
||||
$isMandatory = $script:Cmd.Parameters['UserId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
It 'TokenId should be Mandatory' {
|
||||
Skip-IfMissing 'Set-PveApiToken'
|
||||
$isMandatory = $script:Cmd.Parameters['TokenId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Set-PveApiToken'
|
||||
{ Set-PveApiToken -UserId 'user@pam' -TokenId 'testtoken' -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user