mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-08-10 22:36:52 +00:00
12874d168d
Split the 1544-line Integration.Tests.ps1 into 18 focused test files with numeric prefixes for execution ordering. New shared helper (_IntegrationHelper.ps1): - Credential-based auth (root@pam) instead of API tokens - Skip helpers for env var checks - Resource discovery (Find-TestVm) for cross-file dependencies - Register-TestResource for env-var state passing between files Files created: 00_Connection, 01_Nodes, 02_Users, 03_Storage, 03a_SharedStorage, 04_Network, 05_SDN, 06_VMs, 07_Snapshots, 08_Templates, 09_CloudInit, 10_Containers, 11_LinuxVM, 12_OVA, 13_Firewall, 14_Backup, 15_Tasks, 99_Cleanup Key changes: - All tests use root@pam credentials (not API tokens) - Each file self-contained with own BeforeAll/AfterAll cleanup - Token CRUD tests now idempotent (remove-before-create) - 99_Cleanup is safety-net for any leftover pester-* resources - SharedStorage renamed to 03a_SharedStorage Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
49 lines
1.5 KiB
PowerShell
49 lines
1.5 KiB
PowerShell
#Requires -Module Pester
|
|
|
|
BeforeAll {
|
|
. $PSScriptRoot/_IntegrationHelper.ps1
|
|
Connect-TestPve
|
|
}
|
|
|
|
AfterAll {
|
|
Disconnect-TestPve
|
|
}
|
|
|
|
Describe 'Connection — Integration' -Tag 'Integration' {
|
|
Context 'Connection' {
|
|
It 'Should connect to PVE server' {
|
|
if (Skip-IfNoTarget) { return }
|
|
|
|
$session = Connect-PveServer `
|
|
-Server $script:Host_ `
|
|
-Port $script:Port `
|
|
-Credential (New-Object System.Management.Automation.PSCredential(
|
|
'root@pam',
|
|
(ConvertTo-SecureString $script:Password -AsPlainText -Force)
|
|
)) `
|
|
-SkipCertificateCheck `
|
|
-PassThru
|
|
|
|
$session | Should -Not -BeNullOrEmpty
|
|
$session.Hostname | Should -Be $script:Host_
|
|
$session.AuthMode.ToString() | Should -Be 'Ticket'
|
|
|
|
Test-PveConnection | Should -BeTrue
|
|
}
|
|
|
|
It 'Should detect server version' {
|
|
if (Skip-IfNoTarget) { return }
|
|
|
|
$detail = Test-PveConnection -Detailed
|
|
$detail | Should -Not -BeNullOrEmpty
|
|
$detail.ServerVersion | Should -Not -BeNullOrEmpty
|
|
$detail.ServerVersion.Major | Should -BeIn @(8, 9)
|
|
|
|
# If we know the expected version, verify it matches
|
|
if ($script:PveVersion) {
|
|
$detail.ServerVersion.Major | Should -Be ([int]$script:PveVersion)
|
|
}
|
|
}
|
|
}
|
|
}
|