@@ -5,6 +5,7 @@ Describe 'Azure Monitor Metrics Testing' {
55 $extensionName = " azuremonitor-metrics"
66 $extensionAgentName = " ama-metrics"
77 $extensionAgentNamespace = " kube-system"
8+ $workspaceResourceGroup = $null # Initialize here for shared scope
89
910 . $PSScriptRoot / ../ ../ helper/ Constants.ps1
1011 . $PSScriptRoot / ../ ../ helper/ Helper.ps1
@@ -47,6 +48,23 @@ Describe 'Azure Monitor Metrics Testing' {
4748 $extensionExists | Should -Not - BeNullOrEmpty
4849 }
4950
51+ It ' Verifies rule groups were created' {
52+ $clusterName = $ENVCONFIG.arcClusterName
53+ $expectedRuleGroupNames = @ (
54+ " KubernetesRecordingRulesRuleGroup-$clusterName " ,
55+ " NodeRecordingRulesRuleGroup-$clusterName "
56+ )
57+
58+ $ruleGroups = az resource list -- resource- group $ ($ENVCONFIG.resourceGroup ) -- resource- type " Microsoft.AlertsManagement/prometheusRuleGroups" -- query " [].{name:name, location:location, id:id}" | ConvertFrom-Json
59+ $ruleGroups | Should -Not - BeNullOrEmpty - Because " Rule groups may take time to be created after extension onboarding"
60+
61+ foreach ($expectedName in $expectedRuleGroupNames ) {
62+ $matchingGroup = $ruleGroups | Where-Object { $_.name -eq $expectedName }
63+ $matchingGroup | Should -Not - BeNullOrEmpty - Because " Rule group '$expectedName ' should have been created by create.py"
64+ }
65+ }
66+
67+
5068 It " Deletes the extension from the cluster" {
5169 $output = az $Env: K8sExtensionName delete - c $ ($ENVCONFIG.arcClusterName ) - g $ ($ENVCONFIG.resourceGroup ) -- cluster- type connectedClusters - n $extensionName -- force
5270 $? | Should - BeTrue
0 commit comments