forked from Azure/azure-cli-extensions
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test case for flux extension (#184)
- Loading branch information
1 parent
1aaef92
commit 2ecb63a
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
Describe 'Azure Flux Testing' { | ||
BeforeAll { | ||
$extensionType = "microsoft.flux" | ||
$extensionName = "flux" | ||
$clusterType = "connectedClusters" | ||
|
||
. $PSScriptRoot/../../helper/Constants.ps1 | ||
. $PSScriptRoot/../../helper/Helper.ps1 | ||
} | ||
|
||
It 'Creates the extension and checks that it onboards correctly' { | ||
$output = az $Env:K8sExtensionName create -c $($ENVCONFIG.arcClusterName) -g $($ENVCONFIG.resourceGroup) --cluster-type $clusterType -n $extensionName --extension-type $extensionType --no-wait | ||
$? | Should -BeTrue | ||
|
||
$n = 0 | ||
do | ||
{ | ||
$output = az $Env:K8sExtensionName show -c $($ENVCONFIG.arcClusterName) -g $($ENVCONFIG.resourceGroup) --cluster-type $clusterType -n $extensionName | ||
$provisioningState = ($output | ConvertFrom-Json).provisioningState | ||
Write-Host "Provisioning State: $provisioningState" | ||
if ($provisioningState -eq "Succeeded") { | ||
break | ||
} | ||
Start-Sleep -Seconds 40 | ||
$n += 1 | ||
} while ($n -le $MAX_RETRY_ATTEMPTS) | ||
$n | Should -BeLessOrEqual $MAX_RETRY_ATTEMPTS | ||
} | ||
|
||
It "Performs a show on the extension" { | ||
$output = az $Env:K8sExtensionName show -c $($ENVCONFIG.arcClusterName) -g $($ENVCONFIG.resourceGroup) --cluster-type $clusterType -n $extensionName | ||
$? | Should -BeTrue | ||
$output | Should -Not -BeNullOrEmpty | ||
} | ||
|
||
It "Lists the extensions on the cluster" { | ||
$output = az $Env:K8sExtensionName list -c $($ENVCONFIG.arcClusterName) -g $($ENVCONFIG.resourceGroup) --cluster-type $clusterType | ||
$? | Should -BeTrue | ||
|
||
$output | Should -Not -BeNullOrEmpty | ||
$extensionExists = $output | ConvertFrom-Json | Where-Object { $_.extensionType -eq $extensionType } | ||
$extensionExists | Should -Not -BeNullOrEmpty | ||
} | ||
|
||
It "Deletes the extension from the cluster" { | ||
$output = az $Env:K8sExtensionName delete -c $($ENVCONFIG.arcClusterName) -g $($ENVCONFIG.resourceGroup) --cluster-type $clusterType -n $extensionName --force | ||
$? | Should -BeTrue | ||
|
||
# Extension should not be found on the cluster | ||
$output = az $Env:K8sExtensionName show -c $($ENVCONFIG.arcClusterName) -g $($ENVCONFIG.resourceGroup) --cluster-type $clusterType -n $extensionName | ||
$? | Should -BeFalse | ||
$output | Should -BeNullOrEmpty | ||
} | ||
|
||
It "Performs another list after the delete" { | ||
$output = az $Env:K8sExtensionName list -c $($ENVCONFIG.arcClusterName) -g $($ENVCONFIG.resourceGroup) --cluster-type $clusterType | ||
$? | Should -BeTrue | ||
$output | Should -Not -BeNullOrEmpty | ||
|
||
$extensionExists = $output | ConvertFrom-Json | Where-Object { $_.extensionType -eq $extensionName } | ||
$extensionExists | Should -BeNullOrEmpty | ||
} | ||
} |