|
| 1 | +Describe 'Azure Monitor High Scale Mode Testing' { |
| 2 | + BeforeAll { |
| 3 | + $extensionType = "microsoft.azuremonitor.containers" |
| 4 | + $extensionName = "azuremonitor-containers" |
| 5 | + $extensionAgentName = "omsagent" |
| 6 | + $extensionAgentNamespace = "kube-system" |
| 7 | + |
| 8 | + . $PSScriptRoot/../../helper/Constants.ps1 |
| 9 | + . $PSScriptRoot/../../helper/Helper.ps1 |
| 10 | + } |
| 11 | + |
| 12 | + It 'Creates the extension with high log scale mode and checks that it onboards correctly' { |
| 13 | + az $Env:K8sExtensionName create -c $($ENVCONFIG.arcClusterName) -g $($ENVCONFIG.resourceGroup) ` |
| 14 | + --cluster-type connectedClusters --extension-type $extensionType -n $extensionName ` |
| 15 | + --configuration-settings "amalogs.enableHighLogScaleMode=true" --no-wait |
| 16 | + $? | Should -BeTrue |
| 17 | + |
| 18 | + $output = az $Env:K8sExtensionName show -c $($ENVCONFIG.arcClusterName) -g $($ENVCONFIG.resourceGroup) --cluster-type connectedClusters -n $extensionName |
| 19 | + $? | Should -BeTrue |
| 20 | + |
| 21 | + $extension = ($output | ConvertFrom-Json) |
| 22 | + $isAutoUpgradeMinorVersion = $extension.autoUpgradeMinorVersion |
| 23 | + $isAutoUpgradeMinorVersion.ToString() -eq "True" | Should -BeTrue |
| 24 | + |
| 25 | + # Verify high scale mode configuration |
| 26 | + $settings = $extension.configurationSettings |
| 27 | + $settings.'amalogs.enableHighLogScaleMode' | Should -Be "true" |
| 28 | + |
| 29 | + # Loop and retry until the extension installs |
| 30 | + $n = 0 |
| 31 | + do |
| 32 | + { |
| 33 | + if (Has-ExtensionData $extensionName) { |
| 34 | + break |
| 35 | + } |
| 36 | + Start-Sleep -Seconds 10 |
| 37 | + $n += 1 |
| 38 | + } while ($n -le $MAX_RETRY_ATTEMPTS) |
| 39 | + $n | Should -BeLessOrEqual $MAX_RETRY_ATTEMPTS |
| 40 | + } |
| 41 | + |
| 42 | + It "Performs a show on the extension" { |
| 43 | + $output = az $Env:K8sExtensionName show -c $($ENVCONFIG.arcClusterName) -g $($ENVCONFIG.resourceGroup) --cluster-type connectedClusters -n $extensionName |
| 44 | + $? | Should -BeTrue |
| 45 | + $output | Should -Not -BeNullOrEmpty |
| 46 | + } |
| 47 | + |
| 48 | + It "Lists the extensions on the cluster" { |
| 49 | + $output = az $Env:K8sExtensionName list -c $($ENVCONFIG.arcClusterName) -g $($ENVCONFIG.resourceGroup) --cluster-type connectedClusters |
| 50 | + $? | Should -BeTrue |
| 51 | + |
| 52 | + $output | Should -Not -BeNullOrEmpty |
| 53 | + $extensionExists = $output | ConvertFrom-Json | Where-Object { $_.extensionType -eq $extensionType } |
| 54 | + $extensionExists | Should -Not -BeNullOrEmpty |
| 55 | + } |
| 56 | + |
| 57 | + It "Deletes the extension from the cluster" { |
| 58 | + $output = az $Env:K8sExtensionName delete -c $($ENVCONFIG.arcClusterName) -g $($ENVCONFIG.resourceGroup) --cluster-type connectedClusters -n $extensionName --force |
| 59 | + $? | Should -BeTrue |
| 60 | + |
| 61 | + # Extension should not be found on the cluster |
| 62 | + $output = az $Env:K8sExtensionName show -c $($ENVCONFIG.arcClusterName) -g $($ENVCONFIG.resourceGroup) --cluster-type connectedClusters -n $extensionName |
| 63 | + $? | Should -BeFalse |
| 64 | + $output | Should -BeNullOrEmpty |
| 65 | + } |
| 66 | + |
| 67 | + It "Performs another list after the delete" { |
| 68 | + $output = az $Env:K8sExtensionName list -c $($ENVCONFIG.arcClusterName) -g $($ENVCONFIG.resourceGroup) --cluster-type connectedClusters |
| 69 | + $? | Should -BeTrue |
| 70 | + $output | Should -Not -BeNullOrEmpty |
| 71 | + |
| 72 | + $extensionExists = $output | ConvertFrom-Json | Where-Object { $_.extensionType -eq $extensionName } |
| 73 | + $extensionExists | Should -BeNullOrEmpty |
| 74 | + } |
| 75 | +} |
0 commit comments