1
+ $loadEnvPath = Join-Path $PSScriptRoot ' loadEnv.ps1'
2
+ if (-Not (Test-Path - Path $loadEnvPath )) {
3
+ $loadEnvPath = Join-Path $PSScriptRoot ' ..\loadEnv.ps1'
4
+ }
5
+ . ($loadEnvPath )
6
+ $TestRecordingFile = Join-Path $PSScriptRoot ' Get-AzsRPHealth.Recording.json'
7
+ $currentPath = $PSScriptRoot
8
+ while (-not $mockingPath ) {
9
+ $mockingPath = Get-ChildItem - Path $currentPath - Recurse - Include ' HttpPipelineMocking.ps1' - File
10
+ $currentPath = Split-Path - Path $currentPath - Parent
11
+ }
12
+ . ($mockingPath | Select-Object - First 1 ).FullName
13
+
14
+ Describe " AzsServiceHealths" - Tags @ (' AzsServiceHealth' , ' InfrastructureInsightsAdmin' ) {
15
+
16
+ . $PSScriptRoot \Common.ps1
17
+
18
+ it " TestListServiceHealths" - Skip:$ (' TestListServiceHealths' -in $global :SkippedTests ) {
19
+ $global :TestName = ' TestListServiceHealths'
20
+
21
+
22
+ $RegionHealths = Get-AzsRegionHealth - Location $global :Location - ResourceGroupName $global :ResourceGroupName
23
+ foreach ($RegionHealth in $RegionHealths ) {
24
+ $ServiceHealths = Get-AzsRPHealth - ResourceGroupName $global :ResourceGroupName - Location $RegionHealth.Name
25
+ foreach ($serviceHealth in $ServiceHealths ) {
26
+ ValidateAzsServiceHealth - ServiceHealth $serviceHealth
27
+ }
28
+ }
29
+ }
30
+
31
+ it " TestGetServiceHealth" - Skip:$ (' TestGetServiceHealth' -in $global :SkippedTests ) {
32
+ $global :TestName = ' TestGetServiceHealth'
33
+
34
+ $RegionHealths = Get-AzsRegionHealth - Location $global :Location - ResourceGroupName $global :ResourceGroupName
35
+ foreach ($RegionHealth in $RegionHealths ) {
36
+ $ServiceHealths = Get-AzsRPHealth - ResourceGroupName $global :ResourceGroupName - Location $RegionHealth.Name
37
+ foreach ($serviceHealth in $ServiceHealths ) {
38
+ $retrieved = Get-AzsRPHealth - ResourceGroupName $global :ResourceGroupName - Location $RegionHealth.Name - ServiceHealth $serviceHealth.RegistrationId
39
+ AssertAzsServiceHealthsAreSame - Expected $serviceHealth - Found $retrieved
40
+ break
41
+ }
42
+ break
43
+ }
44
+ }
45
+
46
+ it " TestGetAllServiceHealths" - Skip:$ (' TestGetAllServiceHealths' -in $global :SkippedTests ) {
47
+ $global :TestName = ' TestGetAllServiceHealths'
48
+
49
+ $RegionHealths = Get-AzsRegionHealth - Location $global :Location - ResourceGroupName $global :ResourceGroupName
50
+ foreach ($RegionHealth in $RegionHealths ) {
51
+ $ServiceHealths = Get-AzsRPHealth - ResourceGroupName $global :ResourceGroupName - Location $RegionHealth.Name
52
+ foreach ($serviceHealth in $ServiceHealths ) {
53
+ $retrieved = Get-AzsRPHealth - ResourceGroupName $global :ResourceGroupName - Location $RegionHealth.Name - ServiceHealth $serviceHealth.RegistrationId
54
+ AssertAzsServiceHealthsAreSame - Expected $serviceHealth - Found $retrieved
55
+ }
56
+ }
57
+ }
58
+
59
+
60
+
61
+ it " TestGetAllServiceHealths" - Skip:$ (' TestGetAllServiceHealths' -in $global :SkippedTests ) {
62
+ $global :TestName = ' TestGetAllServiceHealths'
63
+
64
+ $RegionHealths = Get-AzsRegionHealth - Location $global :Location - ResourceGroupName $global :ResourceGroupName
65
+ foreach ($RegionHealth in $RegionHealths ) {
66
+ $ServiceHealths = Get-AzsRPHealth - ResourceGroupName $global :ResourceGroupName - Location $RegionHealth.Name
67
+ foreach ($serviceHealth in $ServiceHealths ) {
68
+ $retrieved = $serviceHealth | Get-AzsRPHealth
69
+ AssertAzsServiceHealthsAreSame - Expected $serviceHealth - Found $retrieved
70
+ }
71
+ }
72
+ }
73
+ }
0 commit comments