From a8f73197d0697a99b8b63a19cebd7447cabdc31c Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Fri, 8 Dec 2023 17:40:25 +0100 Subject: [PATCH] Certificate(Tests): Use -skip for skip some tests --- Tests/common.ps1 | 1 + Tests/integration/Certificates.Tests.ps1 | 48 +++++++++++------------- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/Tests/common.ps1 b/Tests/common.ps1 index 6887eed..622fedb 100644 --- a/Tests/common.ps1 +++ b/Tests/common.ps1 @@ -35,6 +35,7 @@ $script:MyNewSecurePassword = ConvertTo-SecureString MyNewassword -AsPlainText - $script:VersionBefore680 = $DefaultArubaCPConnection.Version -lt [version]"6.8.0" $script:VersionBefore686 = $DefaultArubaCPConnection.Version -lt [version]"6.8.6" $script:VersionBefore690 = $DefaultArubaCPConnection.Version -lt [version]"6.9.0" +$script:VersionBefore6100 = $DefaultArubaCPConnection.Version -lt [version]"6.10.0" $script:server_uuid = (Get-ArubaCPServerConfiguration).server_uuid[0] diff --git a/Tests/integration/Certificates.Tests.ps1 b/Tests/integration/Certificates.Tests.ps1 index 301fa84..5becf29 100644 --- a/Tests/integration/Certificates.Tests.ps1 +++ b/Tests/integration/Certificates.Tests.ps1 @@ -33,41 +33,37 @@ Describe "Get Cluster Certificates (Get-ArubaCPClusterCertificate)" { } | Should -Not -Throw } - if ($DefaultArubaCPConnection.version -gt "6.10.0") { - It "Get Cluster Certificates with service_name Does not throw an error" { - { - Get-ArubaCPClusterCertificate -service_name "HTTPS(ECC)" - } | Should -Not -Throw - } + It "Get Cluster Certificates with service_name Does not throw an error" -Skip:$VersionBefore6100 { + { + Get-ArubaCPClusterCertificate -service_name "HTTPS(ECC)" + } | Should -Not -Throw } - if ($DefaultArubaCPConnection.version -gt "6.10.0") { - It "Get Cluster Certificates with service_type Does not throw an error" { - { - Get-ArubaCPClusterCertificate -certificate_type "HTTPS(RSA) Server Certificate" - } | Should -Not -Throw - } + + It "Get Cluster Certificates with service_type Does not throw an error" -Skip:$VersionBefore6100 { + { + Get-ArubaCPClusterCertificate -certificate_type "HTTPS(RSA) Server Certificate" + } | Should -Not -Throw } + It "Get Cluster Certificates with service_id" { $cc = Get-ArubaCPClusterCertificate -service_id 1 @($cc).count | Should -Not -Be $NULL } - if ($DefaultArubaCPConnection.version -gt "6.10.0") { - It "Get Cluster Certificates with service_name" { - $cc = Get-ArubaCPClusterCertificate -service_name "HTTPS(ECC)" - @($cc).count | Should -Not -Be $NULL - } + It "Get Cluster Certificates with service_name" -Skip:$VersionBefore6100 { + $cc = Get-ArubaCPClusterCertificate -service_name "HTTPS(ECC)" + @($cc).count | Should -Not -Be $NULL } - if ($DefaultArubaCPConnection.version -gt "6.10.0") { - It "Get Cluster Certificates with service_type" { - $cc = Get-ArubaCPClusterCertificate -certificate_type "HTTPS(RSA) Server Certificate" - @($cc).count | Should -Not -Be $NULL - } + + It "Get Cluster Certificates with service_type" -Skip:$VersionBefore6100 { + $cc = Get-ArubaCPClusterCertificate -certificate_type "HTTPS(RSA) Server Certificate" + @($cc).count | Should -Not -Be $NULL } + } Describe "Get Server Certificate (Get-ArubaCPServerCertificate)" { @@ -83,11 +79,9 @@ Describe "Get Server Certificate (Get-ArubaCPServerCertificate)" { @($cc).count | Should -Not -Be $NULL } - if ($DefaultArubaCPConnection.version -gt "6.10.0") { - It "Get Server Certificate and confirm" { - $cc = Get-ArubaCPServerCertificate -service_name "HTTPS(RSA)" -server_uuid $server_uuid - Confirm-ArubaCPServerCertificate $cc | Should -Be $true - } + It "Get Server Certificate and confirm" -Skip:$VersionBefore6100 { + $cc = Get-ArubaCPServerCertificate -service_name "HTTPS(RSA)" -server_uuid $server_uuid + Confirm-ArubaCPServerCertificate $cc | Should -Be $true } }