diff --git a/.azure-pipelines/live-test.yml b/.azure-pipelines/live-test.yml index 5d3edae7fad7..536c777ddc54 100644 --- a/.azure-pipelines/live-test.yml +++ b/.azure-pipelines/live-test.yml @@ -26,7 +26,7 @@ parameters: - name: ps_7_2_x displayName: PowerShell 7.2.x Version type: string - default: 7.2.9 + default: 7.2.8 - name: ps_latest displayName: PowerShell Latest Version type: string diff --git a/src/Aks/Aks.Test/LiveTests/TestLiveScenarios.ps1 b/src/Aks/Aks.Test/LiveTests/TestLiveScenarios.ps1 index f8e3f5f13371..f47b5a4aa236 100644 --- a/src/Aks/Aks.Test/LiveTests/TestLiveScenarios.ps1 +++ b/src/Aks/Aks.Test/LiveTests/TestLiveScenarios.ps1 @@ -1,3 +1,6 @@ +$PreDebugPreference = $DebugPreference +$DebugPreference = 'Continue' + Invoke-LiveTestScenario -Name "Test_AKS_CURD" -Description "Test AKS Cluster CRUD and node pool CRU" -ScenarioScript ` { param ($rg) @@ -6,12 +9,12 @@ Invoke-LiveTestScenario -Name "Test_AKS_CURD" -Description "Test AKS Cluster CRU # Generate random resource name if necessary $kubeClusterName = New-LiveTestResourceName - + # step 1: create a default aks cluster with default node pool - + ssh-keygen -t rsa -f id_rsa -q -N '"123456"' $sshKeyValue = Get-Content id_rsa.pub -Raw - + $kvName = "LiveTestKeyVault" $aksSPIdKey = "AKSSPId" $aksSPSecretKey = "AKSSPSecret" @@ -20,9 +23,14 @@ Invoke-LiveTestScenario -Name "Test_AKS_CURD" -Description "Test AKS Cluster CRU $servicePrincipalSecureSecret = ConvertTo-SecureString -String $ServicePrincipalSecret -AsPlainText -Force $servicePrincipalCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $ServicePrincipalId, $servicePrincipalSecureSecret + Write-Host "##[section]Start to create Aks cluster : New-AzAksCluster" New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName -SshKeyValue $sshKeyValue -ServicePrincipalIdAndSecret $servicePrincipalCredential - + Write-Host "##[section]Finished creating Aks cluster : New-AzAksCluster" + + Write-Host "##[section]Start to retrieve Aks cluster : Get-AzAksCluster" $cluster = Get-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName + Write-Host "##[section]Finished retrieving Aks cluster : Get-AzAksCluster" + Assert-NotNull $cluster.Fqdn Assert-NotNull $cluster.KubernetesVersion Assert-NotNull $cluster.DnsPrefix @@ -34,8 +42,11 @@ Invoke-LiveTestScenario -Name "Test_AKS_CURD" -Description "Test AKS Cluster CRU Assert-AreEqual 1 $cluster.AgentPoolProfiles.Length Assert-AreEqual 3 $cluster.AgentPoolProfiles[0].Count Assert-NotNull $cluster.AgentPoolProfiles[0].NodeImageVersion - + + Write-Host "##[section]Start to retrieve Aks node pool : Get-AzAksNodePool" $pools = Get-AzAksNodePool -ResourceGroupName $resourceGroupName -ClusterName $kubeClusterName + Write-Host "##[section]Finished retrieving Aks node pool : Get-AzAksNodePool" + Assert-NotNull $pools.VmSize Assert-NotNull $pools.OsDiskSizeGB Assert-NotNull $pools.OrchestratorVersion @@ -76,29 +87,46 @@ Invoke-LiveTestScenario -Name "Test_AKS_CURD" -Description "Test AKS Cluster CRU Assert-Null $pools.CreationData Assert-Null $pools.HostGroupID Assert-False {$pools.EnableFIPS} - + # step 2: update the aks cluster + Write-Host "##[section]Start to update Aks cluster : Set-AzAksCluster" $cluster = $cluster | Set-AzAksCluster -NodeCount 4 -EnableUptimeSLA + Write-Host "##[section]Finished updating Aks cluster : Set-AzAksCluster" + Assert-AreEqual 4 $cluster.AgentPoolProfiles[0].Count Assert-AreEqual "Basic" $cluster.Sku.Name Assert-AreEqual "Paid" $cluster.Sku.Tier - + # step 3: create the second node pool $pool1Name = "default" $pool2Name = "pool2" + + Write-Host "##[section]Start to create Aks node pool : New-AzAksNodePool" New-AzAksNodePool -ResourceGroupName $resourceGroupName -ClusterName $kubeClusterName -Name $pool2Name -OsType "Windows" -OsSKU "Windows2022" -Count 1 -VmSetType VirtualMachineScaleSets + Write-Host "##[section]Finished creating Aks node pool : New-AzAksNodePool" + + Write-Host "##[section]Start to retrieve Aks node pool : Get-AzAksNodePool" $pools = Get-AzAksNodePool -ResourceGroupName $resourceGroupName -ClusterName $kubeClusterName + Write-Host "##[section]Finished retrieving Aks node pool : Get-AzAksNodePool" + Assert-AreEqual 2 $pools.Count Assert-AreEqualArray "Linux" ($pools | where {$_.Name -eq $pool1Name}).OsType Assert-AreEqualArray "Ubuntu" ($pools | where {$_.Name -eq $pool1Name}).OsSKU Assert-AreEqualArray "Windows" ($pools | where {$_.Name -eq $pool2Name}).OsType Assert-AreEqualArray "Windows2022" ($pools | where {$_.Name -eq $pool2Name}).OsSKU - + # step4: update the second node pool $labels = @{"someId" = 127; "tier" = "frontend"; "environment" = "qa" } $tags = @{"dept"="MM"; "costcenter"=7777; "Admin"="Cindy"} + + Write-Host "##[section]Start to update Aks node pool : Update-AzAksNodePool" Update-AzAksNodePool -ResourceGroupName $resourceGroupName -ClusterName $kubeClusterName -Name $pool2Name -NodeLabel $labels -Tag $tags + Write-Host "##[section]Finished updating Aks node pool : Update-AzAksNodePool" + + Write-Host "##[section]Start to retrieve Aks cluster : Get-AzAksCluster" $cluster = Get-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName + Write-Host "##[section]Finished retrieving Aks cluster : Get-AzAksCluster" + Assert-AreEqual 2 $cluster.AgentPoolProfiles.Count Assert-AreEqual 0 ($cluster.AgentPoolProfiles | where {$_.Name -eq $pool1Name}).NodeLabels.Count Assert-AreEqual 0 ($cluster.AgentPoolProfiles | where {$_.Name -eq $pool1Name}).Tags.Count @@ -108,7 +136,11 @@ Invoke-LiveTestScenario -Name "Test_AKS_CURD" -Description "Test AKS Cluster CRU Assert-AreEqual MM ($cluster.AgentPoolProfiles | where {$_.Name -eq $pool2Name}).Tags.dept Assert-AreEqual 7777 ($cluster.AgentPoolProfiles | where {$_.Name -eq $pool2Name}).Tags.costcenter Assert-AreEqual Cindy ($cluster.AgentPoolProfiles | where {$_.Name -eq $pool2Name}).Tags.Admin + + Write-Host "##[section]Start to retrieve Aks node pool : Get-AzAksNodePool" $pools = Get-AzAksNodePool -ResourceGroupName $resourceGroupName -ClusterName $kubeClusterName + Write-Host "##[section]Finished retrieving Aks node pool : Get-AzAksNodePool" + Assert-AreEqual 2 $pools.Count Assert-AreEqual 0 ($pools | where {$_.Name -eq $pool1Name}).NodeLabels.Count Assert-AreEqual 0 ($pools | where {$_.Name -eq $pool1Name}).Tags.Count @@ -118,7 +150,11 @@ Invoke-LiveTestScenario -Name "Test_AKS_CURD" -Description "Test AKS Cluster CRU Assert-AreEqual MM ($pools | where {$_.Name -eq $pool2Name}).Tags.dept Assert-AreEqual 7777 ($pools | where {$_.Name -eq $pool2Name}).Tags.costcenter Assert-AreEqual Cindy ($pools | where {$_.Name -eq $pool2Name}).Tags.Admin - + + Write-Host "##[section]Start to remove Aks cluster : Remove-AzAksCluster" $cluster | Remove-AzAksCluster -Force + Write-Host "##[section]Finished removing Aks cluster : Remove-AzAksCluster" + +} -} \ No newline at end of file +$DebugPreference = $PreDebugPreference