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
@@ -5,126 +5,35 @@
|
||||
Copy-PveContainer, Get-PveContainerConfig, Set-PveContainerConfig.
|
||||
|
||||
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 @('Copy-PveContainer', 'Get-PveContainerConfig', 'Set-PveContainerConfig')) {
|
||||
$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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Manifest contract
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Container config cmdlets — manifest declarations' {
|
||||
BeforeAll {
|
||||
$manifestPath = Join-Path (Get-Module PSProxmoxVE).ModuleBase 'PSProxmoxVE.psd1'
|
||||
$script:Manifest = if (Test-Path $manifestPath) { Import-PowerShellDataFile $manifestPath } else { $null }
|
||||
}
|
||||
|
||||
It "<cmdName> should be declared in CmdletsToExport" -TestCases @(
|
||||
@{ cmdName = 'Copy-PveContainer' }
|
||||
@{ cmdName = 'Get-PveContainerConfig' }
|
||||
@{ cmdName = 'Set-PveContainerConfig' }
|
||||
) {
|
||||
if ($null -eq $script:Manifest) { Set-ItResult -Skipped -Because 'Manifest not found'; return }
|
||||
$script:Manifest.CmdletsToExport | Should -Contain $cmdName
|
||||
}
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Copy-PveContainer
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Copy-PveContainer' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Copy-PveContainer' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Copy-PveContainer'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Copy-PveContainer'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Copy-PveContainer' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Copy-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should support Confirm' {
|
||||
Skip-IfMissing 'Copy-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('Confirm') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'SourceNode should be Mandatory' {
|
||||
Skip-IfMissing 'Copy-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['SourceNode'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'VmId should be Mandatory' {
|
||||
Skip-IfMissing 'Copy-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['VmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Optional parameters' {
|
||||
It 'Should have NewVmId parameter' {
|
||||
Skip-IfMissing 'Copy-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('NewVmId') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'NewVmId should not be Mandatory' {
|
||||
Skip-IfMissing 'Copy-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['NewVmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'Should have NewName parameter' {
|
||||
Skip-IfMissing 'Copy-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('NewName') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should have TargetNode parameter' {
|
||||
Skip-IfMissing 'Copy-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('TargetNode') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should have Full switch parameter' {
|
||||
Skip-IfMissing 'Copy-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('Full') | Should -BeTrue
|
||||
$script:Cmd.Parameters['Full'].SwitchParameter | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should have Storage parameter' {
|
||||
Skip-IfMissing 'Copy-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('Storage') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should have Wait switch parameter' {
|
||||
Skip-IfMissing 'Copy-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('Wait') | Should -BeTrue
|
||||
$script:Cmd.Parameters['Wait'].SwitchParameter | Should -BeTrue
|
||||
}
|
||||
@@ -132,7 +41,6 @@ Describe 'Copy-PveContainer' {
|
||||
|
||||
Context 'Pipeline support' {
|
||||
It 'VmId should accept pipeline input by property name' {
|
||||
Skip-IfMissing 'Copy-PveContainer'
|
||||
$vmid = $script:Cmd.Parameters['VmId']
|
||||
$acceptsByPropName = $vmid.ParameterSets.Values |
|
||||
Where-Object { $_.ValueFromPipelineByPropertyName }
|
||||
@@ -140,16 +48,8 @@ Describe 'Copy-PveContainer' {
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Session parameter' {
|
||||
It 'Should have Session parameter (inherited from PveCmdletBase)' {
|
||||
Skip-IfMissing 'Copy-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('Session') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Copy-PveContainer'
|
||||
{ Copy-PveContainer -SourceNode 'pve1' -VmId 100 -Confirm:$false -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -160,40 +60,10 @@ Describe 'Copy-PveContainer' {
|
||||
# Get-PveContainerConfig
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Get-PveContainerConfig' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Get-PveContainerConfig' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Get-PveContainerConfig'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Get-PveContainerConfig'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Get-PveContainerConfig'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'VmId should be Mandatory' {
|
||||
Skip-IfMissing 'Get-PveContainerConfig'
|
||||
$isMandatory = $script:Cmd.Parameters['VmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Get-PveContainerConfig' }
|
||||
|
||||
Context 'Pipeline support' {
|
||||
It 'Node should accept pipeline input by property name' {
|
||||
Skip-IfMissing 'Get-PveContainerConfig'
|
||||
$node = $script:Cmd.Parameters['Node']
|
||||
$acceptsByPropName = $node.ParameterSets.Values |
|
||||
Where-Object { $_.ValueFromPipelineByPropertyName }
|
||||
@@ -201,7 +71,6 @@ Describe 'Get-PveContainerConfig' {
|
||||
}
|
||||
|
||||
It 'VmId should accept pipeline input by property name' {
|
||||
Skip-IfMissing 'Get-PveContainerConfig'
|
||||
$vmid = $script:Cmd.Parameters['VmId']
|
||||
$acceptsByPropName = $vmid.ParameterSets.Values |
|
||||
Where-Object { $_.ValueFromPipelineByPropertyName }
|
||||
@@ -209,23 +78,14 @@ Describe 'Get-PveContainerConfig' {
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Session parameter' {
|
||||
It 'Should have Session parameter (inherited from PveCmdletBase)' {
|
||||
Skip-IfMissing 'Get-PveContainerConfig'
|
||||
$script:Cmd.Parameters.ContainsKey('Session') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'ShouldProcess not required' {
|
||||
It 'Should not have WhatIf (Get verb is read-only)' {
|
||||
Skip-IfMissing 'Get-PveContainerConfig'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeFalse
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Get-PveContainerConfig'
|
||||
{ Get-PveContainerConfig -Node 'pve1' -VmId 100 -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -236,101 +96,20 @@ Describe 'Get-PveContainerConfig' {
|
||||
# Set-PveContainerConfig
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Set-PveContainerConfig' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveContainerConfig' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Set-PveContainerConfig' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should support Confirm' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
$script:Cmd.Parameters.ContainsKey('Confirm') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'VmId should be Mandatory' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
$isMandatory = $script:Cmd.Parameters['VmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Optional configuration parameters' {
|
||||
It 'Should have Hostname parameter' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
$script:Cmd.Parameters.ContainsKey('Hostname') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Hostname should not be Mandatory' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
$isMandatory = $script:Cmd.Parameters['Hostname'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'Should have Cores parameter' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
$script:Cmd.Parameters.ContainsKey('Cores') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should have Memory parameter' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
$script:Cmd.Parameters.ContainsKey('Memory') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should have Swap parameter' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
$script:Cmd.Parameters.ContainsKey('Swap') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should have Description parameter' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
$script:Cmd.Parameters.ContainsKey('Description') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should have Tags parameter' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
$script:Cmd.Parameters.ContainsKey('Tags') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should have Nameserver parameter' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
$script:Cmd.Parameters.ContainsKey('Nameserver') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should have SearchDomain parameter' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
$script:Cmd.Parameters.ContainsKey('SearchDomain') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Pipeline support' {
|
||||
It 'Node should accept pipeline input by property name' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
$node = $script:Cmd.Parameters['Node']
|
||||
$acceptsByPropName = $node.ParameterSets.Values |
|
||||
Where-Object { $_.ValueFromPipelineByPropertyName }
|
||||
@@ -338,7 +117,6 @@ Describe 'Set-PveContainerConfig' {
|
||||
}
|
||||
|
||||
It 'VmId should accept pipeline input by property name' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
$vmid = $script:Cmd.Parameters['VmId']
|
||||
$acceptsByPropName = $vmid.ParameterSets.Values |
|
||||
Where-Object { $_.ValueFromPipelineByPropertyName }
|
||||
@@ -346,16 +124,8 @@ Describe 'Set-PveContainerConfig' {
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Session parameter' {
|
||||
It 'Should have Session parameter (inherited from PveCmdletBase)' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
$script:Cmd.Parameters.ContainsKey('Session') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Set-PveContainerConfig'
|
||||
{ Set-PveContainerConfig -Node 'pve1' -VmId 100 -Hostname 'test' -Confirm:$false -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
|
||||
@@ -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*'
|
||||
}
|
||||
|
||||
@@ -6,75 +6,28 @@
|
||||
Start-PveContainer, Stop-PveContainer, Restart-PveContainer.
|
||||
|
||||
All tests are fully offline — no live Proxmox VE target is required.
|
||||
If a cmdlet is not yet compiled into the DLL the test is marked Skipped.
|
||||
#>
|
||||
|
||||
BeforeAll {
|
||||
. $PSScriptRoot/../_TestHelper.ps1
|
||||
|
||||
# Pre-calculate availability for each cmdlet.
|
||||
$script:Availability = @{}
|
||||
foreach ($name in @('New-PveContainer', 'Remove-PveContainer',
|
||||
'Start-PveContainer', 'Stop-PveContainer',
|
||||
'Restart-PveContainer',
|
||||
'Get-PveContainerConfig', 'Set-PveContainerConfig',
|
||||
'Copy-PveContainer', 'Move-PveContainer')) {
|
||||
$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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# New-PveContainer
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'New-PveContainer' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'New-PveContainer' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'New-PveContainer'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'New-PveContainer' }
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'New-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'New-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Context 'Optional parameters' {
|
||||
It 'Should have Wait switch parameter' {
|
||||
Skip-IfMissing 'New-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('Wait') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should have Session parameter' {
|
||||
Skip-IfMissing 'New-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('Session') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active (without -WhatIf)' {
|
||||
Skip-IfMissing 'New-PveContainer'
|
||||
{ New-PveContainer -Node 'pve-node1' -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -85,24 +38,14 @@ Describe 'New-PveContainer' {
|
||||
# Remove-PveContainer
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Remove-PveContainer' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Remove-PveContainer' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Remove-PveContainer'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Remove-PveContainer' }
|
||||
|
||||
Context 'ShouldProcess / ConfirmImpact' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Remove-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should declare ConfirmImpact High' {
|
||||
Skip-IfMissing 'Remove-PveContainer'
|
||||
$attr = $script:Cmd.ImplementingType.GetCustomAttributes(
|
||||
[System.Management.Automation.CmdletAttribute], $false) |
|
||||
Select-Object -First 1
|
||||
@@ -110,42 +53,12 @@ Describe 'Remove-PveContainer' {
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Remove-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'VmId should be Mandatory' {
|
||||
Skip-IfMissing 'Remove-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['VmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Optional parameters' {
|
||||
It 'Should have Purge switch parameter' {
|
||||
Skip-IfMissing 'Remove-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('Purge') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should have Wait switch parameter' {
|
||||
Skip-IfMissing 'Remove-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('Wait') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active (without -WhatIf)' {
|
||||
Skip-IfMissing 'Remove-PveContainer'
|
||||
{ Remove-PveContainer -Node 'pve-node1' -VmId 200 -Confirm:$false -ErrorAction Stop } | Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
|
||||
It 'Should not throw with -WhatIf' {
|
||||
Skip-IfMissing 'Remove-PveContainer'
|
||||
{ Remove-PveContainer -Node 'pve-node1' -VmId 200 -WhatIf -ErrorAction Stop } |
|
||||
Should -Not -Throw
|
||||
}
|
||||
@@ -156,45 +69,16 @@ Describe 'Remove-PveContainer' {
|
||||
# Start-PveContainer
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Start-PveContainer' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Start-PveContainer' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Start-PveContainer'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Start-PveContainer' }
|
||||
|
||||
Context 'Parameter metadata' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Start-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'VmId should be Mandatory' {
|
||||
Skip-IfMissing 'Start-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['VmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'Should have Wait switch parameter' {
|
||||
Skip-IfMissing 'Start-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('Wait') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should support ShouldProcess' {
|
||||
Skip-IfMissing 'Start-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Start-PveContainer'
|
||||
{ Start-PveContainer -Node 'pve-node1' -VmId 200 -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -205,45 +89,16 @@ Describe 'Start-PveContainer' {
|
||||
# Stop-PveContainer
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Stop-PveContainer' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Stop-PveContainer' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Stop-PveContainer'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Stop-PveContainer' }
|
||||
|
||||
Context 'Parameter metadata' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Stop-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'VmId should be Mandatory' {
|
||||
Skip-IfMissing 'Stop-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['VmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'Should have Wait switch parameter' {
|
||||
Skip-IfMissing 'Stop-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('Wait') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should support ShouldProcess' {
|
||||
Skip-IfMissing 'Stop-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Stop-PveContainer'
|
||||
{ Stop-PveContainer -Node 'pve-node1' -VmId 200 -Confirm:$false -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -254,40 +109,16 @@ Describe 'Stop-PveContainer' {
|
||||
# Restart-PveContainer
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Restart-PveContainer' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Restart-PveContainer' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Restart-PveContainer'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Restart-PveContainer' }
|
||||
|
||||
Context 'Parameter metadata' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Restart-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'VmId should be Mandatory' {
|
||||
Skip-IfMissing 'Restart-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['VmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'Should support ShouldProcess' {
|
||||
Skip-IfMissing 'Restart-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Restart-PveContainer'
|
||||
{ Restart-PveContainer -Node 'pve-node1' -VmId 200 -Confirm:$false -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -298,57 +129,16 @@ Describe 'Restart-PveContainer' {
|
||||
# Move-PveContainer
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Move-PveContainer' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Move-PveContainer' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Move-PveContainer'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Move-PveContainer' }
|
||||
|
||||
Context 'Parameter metadata' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Move-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'VmId should be Mandatory' {
|
||||
Skip-IfMissing 'Move-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['VmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'TargetNode should be Mandatory' {
|
||||
Skip-IfMissing 'Move-PveContainer'
|
||||
$isMandatory = $script:Cmd.Parameters['TargetNode'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'Should have Online switch parameter' {
|
||||
Skip-IfMissing 'Move-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('Online') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should have Wait switch parameter' {
|
||||
Skip-IfMissing 'Move-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('Wait') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should support ShouldProcess' {
|
||||
Skip-IfMissing 'Move-PveContainer'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Move-PveContainer'
|
||||
{ Move-PveContainer -Node 'pve-node1' -VmId 200 -TargetNode 'pve-node2' -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
|
||||
@@ -6,93 +6,20 @@
|
||||
Remove-PveContainerSnapshot, Restore-PveContainerSnapshot.
|
||||
|
||||
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-PveContainerSnapshot', 'New-PveContainerSnapshot',
|
||||
'Remove-PveContainerSnapshot', 'Restore-PveContainerSnapshot')) {
|
||||
$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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Manifest contract
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Container snapshot cmdlets — manifest declarations' {
|
||||
BeforeAll {
|
||||
$manifestPath = Join-Path (Get-Module PSProxmoxVE).ModuleBase 'PSProxmoxVE.psd1'
|
||||
$script:Manifest = if (Test-Path $manifestPath) { Import-PowerShellDataFile $manifestPath } else { $null }
|
||||
}
|
||||
|
||||
It "<cmdName> should be declared in CmdletsToExport" -TestCases @(
|
||||
@{ cmdName = 'Get-PveContainerSnapshot' }
|
||||
@{ cmdName = 'New-PveContainerSnapshot' }
|
||||
@{ cmdName = 'Remove-PveContainerSnapshot' }
|
||||
@{ cmdName = 'Restore-PveContainerSnapshot' }
|
||||
) {
|
||||
if ($null -eq $script:Manifest) { Set-ItResult -Skipped -Because 'Manifest not found'; return }
|
||||
$script:Manifest.CmdletsToExport | Should -Contain $cmdName
|
||||
}
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Get-PveContainerSnapshot
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Get-PveContainerSnapshot' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Get-PveContainerSnapshot' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Get-PveContainerSnapshot'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
Skip-IfMissing 'Get-PveContainerSnapshot'
|
||||
$script:Cmd.CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Parameter metadata' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Get-PveContainerSnapshot'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'VmId should be Mandatory' {
|
||||
Skip-IfMissing 'Get-PveContainerSnapshot'
|
||||
$isMandatory = $script:Cmd.Parameters['VmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'Should have Name parameter (optional filter by snapshot name)' {
|
||||
Skip-IfMissing 'Get-PveContainerSnapshot'
|
||||
$script:Cmd.Parameters.ContainsKey('Name') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should have Session parameter' {
|
||||
Skip-IfMissing 'Get-PveContainerSnapshot'
|
||||
$script:Cmd.Parameters.ContainsKey('Session') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Get-PveContainerSnapshot' }
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
Skip-IfMissing 'Get-PveContainerSnapshot'
|
||||
{ Get-PveContainerSnapshot -Node 'pve-node1' -VmId 100 -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -103,66 +30,22 @@ Describe 'Get-PveContainerSnapshot' {
|
||||
# New-PveContainerSnapshot
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'New-PveContainerSnapshot' {
|
||||
BeforeAll { $script:Cmd = Get-Command 'New-PveContainerSnapshot' }
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'New-PveContainerSnapshot' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'New-PveContainerSnapshot'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
Context 'Parameter surface' {
|
||||
It 'Should NOT have IncludeVmState (LXC containers do not support RAM snapshots)' {
|
||||
$script:Cmd.Parameters.ContainsKey('IncludeVmState') | Should -BeFalse
|
||||
}
|
||||
}
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'New-PveContainerSnapshot'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'New-PveContainerSnapshot'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'VmId should be Mandatory' {
|
||||
Skip-IfMissing 'New-PveContainerSnapshot'
|
||||
$isMandatory = $script:Cmd.Parameters['VmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'Name (snapshot name) should be Mandatory' {
|
||||
Skip-IfMissing 'New-PveContainerSnapshot'
|
||||
$isMandatory = $script:Cmd.Parameters['Name'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Optional parameters' {
|
||||
It 'Should have Description parameter' {
|
||||
Skip-IfMissing 'New-PveContainerSnapshot'
|
||||
$script:Cmd.Parameters.ContainsKey('Description') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should have Wait switch parameter' {
|
||||
Skip-IfMissing 'New-PveContainerSnapshot'
|
||||
$script:Cmd.Parameters.ContainsKey('Wait') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should NOT have IncludeVmState (LXC containers do not support RAM snapshots)' {
|
||||
Skip-IfMissing 'New-PveContainerSnapshot'
|
||||
$script:Cmd.Parameters.ContainsKey('IncludeVmState') | Should -BeFalse
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active (without -WhatIf)' {
|
||||
Skip-IfMissing 'New-PveContainerSnapshot'
|
||||
{ New-PveContainerSnapshot -Node 'pve-node1' -VmId 100 -Name 'snap1' -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -173,24 +56,14 @@ Describe 'New-PveContainerSnapshot' {
|
||||
# Remove-PveContainerSnapshot
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Remove-PveContainerSnapshot' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Remove-PveContainerSnapshot' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Remove-PveContainerSnapshot'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Remove-PveContainerSnapshot' }
|
||||
|
||||
Context 'ShouldProcess / ConfirmImpact' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Remove-PveContainerSnapshot'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should declare ConfirmImpact High' {
|
||||
Skip-IfMissing 'Remove-PveContainerSnapshot'
|
||||
$attr = $script:Cmd.ImplementingType.GetCustomAttributes(
|
||||
[System.Management.Automation.CmdletAttribute], $false) |
|
||||
Select-Object -First 1
|
||||
@@ -198,32 +71,8 @@ Describe 'Remove-PveContainerSnapshot' {
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Remove-PveContainerSnapshot'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'VmId should be Mandatory' {
|
||||
Skip-IfMissing 'Remove-PveContainerSnapshot'
|
||||
$isMandatory = $script:Cmd.Parameters['VmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'Name should be Mandatory' {
|
||||
Skip-IfMissing 'Remove-PveContainerSnapshot'
|
||||
$isMandatory = $script:Cmd.Parameters['Name'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active (without -WhatIf)' {
|
||||
Skip-IfMissing 'Remove-PveContainerSnapshot'
|
||||
{ Remove-PveContainerSnapshot -Node 'pve-node1' -VmId 100 -Name 'snap1' -Confirm:$false -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
@@ -234,24 +83,14 @@ Describe 'Remove-PveContainerSnapshot' {
|
||||
# Restore-PveContainerSnapshot
|
||||
# ---------------------------------------------------------------------------
|
||||
Describe 'Restore-PveContainerSnapshot' {
|
||||
|
||||
BeforeAll { $script:Cmd = Get-Command 'Restore-PveContainerSnapshot' -ErrorAction SilentlyContinue }
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Skip-IfMissing 'Restore-PveContainerSnapshot'
|
||||
$script:Cmd | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
BeforeAll { $script:Cmd = Get-Command 'Restore-PveContainerSnapshot' }
|
||||
|
||||
Context 'ShouldProcess / ConfirmImpact' {
|
||||
It 'Should support WhatIf' {
|
||||
Skip-IfMissing 'Restore-PveContainerSnapshot'
|
||||
$script:Cmd.Parameters.ContainsKey('WhatIf') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should declare ConfirmImpact High' {
|
||||
Skip-IfMissing 'Restore-PveContainerSnapshot'
|
||||
$attr = $script:Cmd.ImplementingType.GetCustomAttributes(
|
||||
[System.Management.Automation.CmdletAttribute], $false) |
|
||||
Select-Object -First 1
|
||||
@@ -259,39 +98,8 @@ Describe 'Restore-PveContainerSnapshot' {
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Required parameters' {
|
||||
It 'Node should be Mandatory' {
|
||||
Skip-IfMissing 'Restore-PveContainerSnapshot'
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'VmId should be Mandatory' {
|
||||
Skip-IfMissing 'Restore-PveContainerSnapshot'
|
||||
$isMandatory = $script:Cmd.Parameters['VmId'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'Name should be Mandatory' {
|
||||
Skip-IfMissing 'Restore-PveContainerSnapshot'
|
||||
$isMandatory = $script:Cmd.Parameters['Name'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Optional parameters' {
|
||||
It 'Should have Wait switch parameter' {
|
||||
Skip-IfMissing 'Restore-PveContainerSnapshot'
|
||||
$script:Cmd.Parameters.ContainsKey('Wait') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active (without -WhatIf)' {
|
||||
Skip-IfMissing 'Restore-PveContainerSnapshot'
|
||||
{ Restore-PveContainerSnapshot -Node 'pve-node1' -VmId 100 -Name 'snap1' -Confirm:$false -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
|
||||
@@ -5,79 +5,19 @@
|
||||
All tests are fully offline — no live Proxmox VE target is required.
|
||||
|
||||
Get-PveContainer mirrors the design of Get-PveVm for LXC containers.
|
||||
If the cmdlet is not yet implemented (dll compiled without it), tests
|
||||
that depend on invocation are marked Skipped rather than Failed.
|
||||
#>
|
||||
|
||||
BeforeAll {
|
||||
. $PSScriptRoot/../_TestHelper.ps1
|
||||
|
||||
$script:CmdExists = $null -ne (Get-Command 'Get-PveContainer' -ErrorAction SilentlyContinue)
|
||||
}
|
||||
|
||||
Describe 'Get-PveContainer' {
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Get-PveContainer should be listed in the module manifest CmdletsToExport' {
|
||||
# The .psd1 declares the cmdlet; implementation may be pending.
|
||||
$manifestPath = Join-Path (Get-Module PSProxmoxVE).ModuleBase 'PSProxmoxVE.psd1'
|
||||
if (Test-Path $manifestPath) {
|
||||
$manifest = Import-PowerShellDataFile $manifestPath
|
||||
$manifest.CmdletsToExport | Should -Contain 'Get-PveContainer'
|
||||
}
|
||||
else {
|
||||
Set-ItResult -Skipped -Because 'Module manifest not found at expected path'
|
||||
}
|
||||
}
|
||||
|
||||
It 'Should be available after module import (or skip if not yet compiled)' {
|
||||
if (-not $script:CmdExists) {
|
||||
Set-ItResult -Skipped -Because 'Get-PveContainer is not yet implemented in this build'
|
||||
return
|
||||
}
|
||||
(Get-Command 'Get-PveContainer').CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Parameter metadata' {
|
||||
BeforeAll {
|
||||
$script:Cmd = Get-Command 'Get-PveContainer' -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
It 'Should have Node parameter' {
|
||||
if (-not $script:CmdExists) { Set-ItResult -Skipped -Because 'Not yet compiled'; return }
|
||||
$script:Cmd.Parameters.ContainsKey('Node') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Node should not be Mandatory (all-nodes query when omitted)' {
|
||||
if (-not $script:CmdExists) { Set-ItResult -Skipped -Because 'Not yet compiled'; return }
|
||||
$isMandatory = $script:Cmd.Parameters['Node'].ParameterSets.Values |
|
||||
Where-Object { $_.IsMandatory }
|
||||
$isMandatory | Should -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'Should have VmId parameter' {
|
||||
if (-not $script:CmdExists) { Set-ItResult -Skipped -Because 'Not yet compiled'; return }
|
||||
$script:Cmd.Parameters.ContainsKey('VmId') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should have Name parameter' {
|
||||
if (-not $script:CmdExists) { Set-ItResult -Skipped -Because 'Not yet compiled'; return }
|
||||
$script:Cmd.Parameters.ContainsKey('Name') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should have Status parameter' {
|
||||
if (-not $script:CmdExists) { Set-ItResult -Skipped -Because 'Not yet compiled'; return }
|
||||
$script:Cmd.Parameters.ContainsKey('Status') | Should -BeTrue
|
||||
}
|
||||
|
||||
It 'Should have Session parameter (inherited from PveCmdletBase)' {
|
||||
if (-not $script:CmdExists) { Set-ItResult -Skipped -Because 'Not yet compiled'; return }
|
||||
$script:Cmd.Parameters.ContainsKey('Session') | Should -BeTrue
|
||||
$script:Cmd = Get-Command 'Get-PveContainer'
|
||||
}
|
||||
|
||||
It 'Node should accept pipeline input by property name' {
|
||||
if (-not $script:CmdExists) { Set-ItResult -Skipped -Because 'Not yet compiled'; return }
|
||||
$node = $script:Cmd.Parameters['Node']
|
||||
$acceptsByPropName = $node.ParameterSets.Values |
|
||||
Where-Object { $_.ValueFromPipelineByPropertyName }
|
||||
@@ -87,7 +27,6 @@ Describe 'Get-PveContainer' {
|
||||
|
||||
Context 'Without active session' {
|
||||
It 'Should throw when no session is active' {
|
||||
if (-not $script:CmdExists) { Set-ItResult -Skipped -Because 'Not yet compiled'; return }
|
||||
{ Get-PveContainer -ErrorAction Stop } |
|
||||
Should -Throw '*No active Proxmox VE session*'
|
||||
}
|
||||
|
||||
@@ -10,18 +10,6 @@ BeforeAll {
|
||||
}
|
||||
|
||||
Describe 'New-PveContainer' {
|
||||
|
||||
Context 'Command existence' {
|
||||
It 'Should be available after module import' {
|
||||
Get-Command 'New-PveContainer' -ErrorAction SilentlyContinue |
|
||||
Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'Should be a CmdletInfo (binary cmdlet)' {
|
||||
(Get-Command 'New-PveContainer').CommandType | Should -Be 'Cmdlet'
|
||||
}
|
||||
}
|
||||
|
||||
Context 'ShouldProcess support' {
|
||||
BeforeAll {
|
||||
$script:Cmd = Get-Command 'New-PveContainer'
|
||||
|
||||
Reference in New Issue
Block a user