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.
[Dapr] Prompt user for existing Dapr installation during extension cr…
…eate (#188) * Add more validations and user prompt for existing installation scenario Signed-off-by: Shubham Sharma <shubhash@microsoft.com> * Add Dapr test' Signed-off-by: Shubham Sharma <shubhash@microsoft.com> * Handle stateful set Signed-off-by: Shubham Sharma <shubhash@microsoft.com> * Update default handling Signed-off-by: Shubham Sharma <shubhash@microsoft.com> * Fix HA handling Signed-off-by: Shubham Sharma <shubhash@microsoft.com> * Add placement service todo Signed-off-by: Shubham Sharma <shubhash@microsoft.com> * Add non-interactive mode Signed-off-by: Shubham Sharma <shubhash@microsoft.com> * Fix lint Signed-off-by: Shubham Sharma <shubhash@microsoft.com> * Update tests Signed-off-by: Shubham Sharma <shubhash@microsoft.com> * Reset configuration for StatefulSet during k8s upgrade Signed-off-by: Shubham Sharma <shubhash@microsoft.com> * Fix lint Signed-off-by: Shubham Sharma <shubhash@microsoft.com> * Retrigger tests Signed-off-by: Shubham Sharma <shubhash@microsoft.com> * Add changes to manage ha and placement params Signed-off-by: Shubham Sharma <shubhash@microsoft.com> * Update message Signed-off-by: Shubham Sharma <shubhash@microsoft.com> * nits Signed-off-by: Shubham Sharma <shubhash@microsoft.com> Signed-off-by: Shubham Sharma <shubhash@microsoft.com>
- Loading branch information
1 parent
477613d
commit cbd30bf
Showing
3 changed files
with
178 additions
and
15 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
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 'DAPR Testing' { | ||
BeforeAll { | ||
$extensionType = "microsoft.dapr" | ||
$extensionName = "dapr" | ||
$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 --configuration-settings "skipExistingDaprCheck=true" --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 | ||
} | ||
} |