Skip to content

Commit 19ace6f

Browse files
authored
Added debug info for Aks module (#20896)
* Removed some of the run instances for the time being * Enabled debug log and added more debug info to Aks live test
1 parent ee92322 commit 19ace6f

File tree

2 files changed

+47
-11
lines changed

2 files changed

+47
-11
lines changed

.azure-pipelines/live-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ parameters:
2626
- name: ps_7_2_x
2727
displayName: PowerShell 7.2.x Version
2828
type: string
29-
default: 7.2.9
29+
default: 7.2.8
3030
- name: ps_latest
3131
displayName: PowerShell Latest Version
3232
type: string

src/Aks/Aks.Test/LiveTests/TestLiveScenarios.ps1

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
$PreDebugPreference = $DebugPreference
2+
$DebugPreference = 'Continue'
3+
14
Invoke-LiveTestScenario -Name "Test_AKS_CURD" -Description "Test AKS Cluster CRUD and node pool CRU" -ScenarioScript `
25
{
36
param ($rg)
@@ -6,12 +9,12 @@ Invoke-LiveTestScenario -Name "Test_AKS_CURD" -Description "Test AKS Cluster CRU
69

710
# Generate random resource name if necessary
811
$kubeClusterName = New-LiveTestResourceName
9-
12+
1013
# step 1: create a default aks cluster with default node pool
11-
14+
1215
ssh-keygen -t rsa -f id_rsa -q -N '"123456"'
1316
$sshKeyValue = Get-Content id_rsa.pub -Raw
14-
17+
1518
$kvName = "LiveTestKeyVault"
1619
$aksSPIdKey = "AKSSPId"
1720
$aksSPSecretKey = "AKSSPSecret"
@@ -20,9 +23,14 @@ Invoke-LiveTestScenario -Name "Test_AKS_CURD" -Description "Test AKS Cluster CRU
2023
$servicePrincipalSecureSecret = ConvertTo-SecureString -String $ServicePrincipalSecret -AsPlainText -Force
2124
$servicePrincipalCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $ServicePrincipalId, $servicePrincipalSecureSecret
2225

26+
Write-Host "##[section]Start to create Aks cluster : New-AzAksCluster"
2327
New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName -SshKeyValue $sshKeyValue -ServicePrincipalIdAndSecret $servicePrincipalCredential
24-
28+
Write-Host "##[section]Finished creating Aks cluster : New-AzAksCluster"
29+
30+
Write-Host "##[section]Start to retrieve Aks cluster : Get-AzAksCluster"
2531
$cluster = Get-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName
32+
Write-Host "##[section]Finished retrieving Aks cluster : Get-AzAksCluster"
33+
2634
Assert-NotNull $cluster.Fqdn
2735
Assert-NotNull $cluster.KubernetesVersion
2836
Assert-NotNull $cluster.DnsPrefix
@@ -34,8 +42,11 @@ Invoke-LiveTestScenario -Name "Test_AKS_CURD" -Description "Test AKS Cluster CRU
3442
Assert-AreEqual 1 $cluster.AgentPoolProfiles.Length
3543
Assert-AreEqual 3 $cluster.AgentPoolProfiles[0].Count
3644
Assert-NotNull $cluster.AgentPoolProfiles[0].NodeImageVersion
37-
45+
46+
Write-Host "##[section]Start to retrieve Aks node pool : Get-AzAksNodePool"
3847
$pools = Get-AzAksNodePool -ResourceGroupName $resourceGroupName -ClusterName $kubeClusterName
48+
Write-Host "##[section]Finished retrieving Aks node pool : Get-AzAksNodePool"
49+
3950
Assert-NotNull $pools.VmSize
4051
Assert-NotNull $pools.OsDiskSizeGB
4152
Assert-NotNull $pools.OrchestratorVersion
@@ -76,29 +87,46 @@ Invoke-LiveTestScenario -Name "Test_AKS_CURD" -Description "Test AKS Cluster CRU
7687
Assert-Null $pools.CreationData
7788
Assert-Null $pools.HostGroupID
7889
Assert-False {$pools.EnableFIPS}
79-
90+
8091
# step 2: update the aks cluster
92+
Write-Host "##[section]Start to update Aks cluster : Set-AzAksCluster"
8193
$cluster = $cluster | Set-AzAksCluster -NodeCount 4 -EnableUptimeSLA
94+
Write-Host "##[section]Finished updating Aks cluster : Set-AzAksCluster"
95+
8296
Assert-AreEqual 4 $cluster.AgentPoolProfiles[0].Count
8397
Assert-AreEqual "Basic" $cluster.Sku.Name
8498
Assert-AreEqual "Paid" $cluster.Sku.Tier
85-
99+
86100
# step 3: create the second node pool
87101
$pool1Name = "default"
88102
$pool2Name = "pool2"
103+
104+
Write-Host "##[section]Start to create Aks node pool : New-AzAksNodePool"
89105
New-AzAksNodePool -ResourceGroupName $resourceGroupName -ClusterName $kubeClusterName -Name $pool2Name -OsType "Windows" -OsSKU "Windows2022" -Count 1 -VmSetType VirtualMachineScaleSets
106+
Write-Host "##[section]Finished creating Aks node pool : New-AzAksNodePool"
107+
108+
Write-Host "##[section]Start to retrieve Aks node pool : Get-AzAksNodePool"
90109
$pools = Get-AzAksNodePool -ResourceGroupName $resourceGroupName -ClusterName $kubeClusterName
110+
Write-Host "##[section]Finished retrieving Aks node pool : Get-AzAksNodePool"
111+
91112
Assert-AreEqual 2 $pools.Count
92113
Assert-AreEqualArray "Linux" ($pools | where {$_.Name -eq $pool1Name}).OsType
93114
Assert-AreEqualArray "Ubuntu" ($pools | where {$_.Name -eq $pool1Name}).OsSKU
94115
Assert-AreEqualArray "Windows" ($pools | where {$_.Name -eq $pool2Name}).OsType
95116
Assert-AreEqualArray "Windows2022" ($pools | where {$_.Name -eq $pool2Name}).OsSKU
96-
117+
97118
# step4: update the second node pool
98119
$labels = @{"someId" = 127; "tier" = "frontend"; "environment" = "qa" }
99120
$tags = @{"dept"="MM"; "costcenter"=7777; "Admin"="Cindy"}
121+
122+
Write-Host "##[section]Start to update Aks node pool : Update-AzAksNodePool"
100123
Update-AzAksNodePool -ResourceGroupName $resourceGroupName -ClusterName $kubeClusterName -Name $pool2Name -NodeLabel $labels -Tag $tags
124+
Write-Host "##[section]Finished updating Aks node pool : Update-AzAksNodePool"
125+
126+
Write-Host "##[section]Start to retrieve Aks cluster : Get-AzAksCluster"
101127
$cluster = Get-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName
128+
Write-Host "##[section]Finished retrieving Aks cluster : Get-AzAksCluster"
129+
102130
Assert-AreEqual 2 $cluster.AgentPoolProfiles.Count
103131
Assert-AreEqual 0 ($cluster.AgentPoolProfiles | where {$_.Name -eq $pool1Name}).NodeLabels.Count
104132
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
108136
Assert-AreEqual MM ($cluster.AgentPoolProfiles | where {$_.Name -eq $pool2Name}).Tags.dept
109137
Assert-AreEqual 7777 ($cluster.AgentPoolProfiles | where {$_.Name -eq $pool2Name}).Tags.costcenter
110138
Assert-AreEqual Cindy ($cluster.AgentPoolProfiles | where {$_.Name -eq $pool2Name}).Tags.Admin
139+
140+
Write-Host "##[section]Start to retrieve Aks node pool : Get-AzAksNodePool"
111141
$pools = Get-AzAksNodePool -ResourceGroupName $resourceGroupName -ClusterName $kubeClusterName
142+
Write-Host "##[section]Finished retrieving Aks node pool : Get-AzAksNodePool"
143+
112144
Assert-AreEqual 2 $pools.Count
113145
Assert-AreEqual 0 ($pools | where {$_.Name -eq $pool1Name}).NodeLabels.Count
114146
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
118150
Assert-AreEqual MM ($pools | where {$_.Name -eq $pool2Name}).Tags.dept
119151
Assert-AreEqual 7777 ($pools | where {$_.Name -eq $pool2Name}).Tags.costcenter
120152
Assert-AreEqual Cindy ($pools | where {$_.Name -eq $pool2Name}).Tags.Admin
121-
153+
154+
Write-Host "##[section]Start to remove Aks cluster : Remove-AzAksCluster"
122155
$cluster | Remove-AzAksCluster -Force
156+
Write-Host "##[section]Finished removing Aks cluster : Remove-AzAksCluster"
157+
158+
}
123159

124-
}
160+
$DebugPreference = $PreDebugPreference

0 commit comments

Comments
 (0)