@@ -15,15 +15,155 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzCdnOriginGroup'))
15
15
}
16
16
17
17
Describe ' Get-AzCdnOriginGroup' {
18
- It ' List' - skip {
19
- { throw [System.NotImplementedException ] } | Should -Not - Throw
18
+ It ' List' {
19
+ {
20
+ $subId = $env.SubscriptionId
21
+ $ResourceGroupName = ' testps-rg-' + (RandomString - allChars $false - len 6 )
22
+ try
23
+ {
24
+ Write-Host - ForegroundColor Green " Create test group $ ( $ResourceGroupName ) "
25
+ New-AzResourceGroup - Name $ResourceGroupName - Location $env.location
26
+
27
+ $cdnProfileName = ' p-' + (RandomString - allChars $false - len 6 );
28
+ Write-Host - ForegroundColor Green " Use cdnProfileName : $ ( $cdnProfileName ) "
29
+
30
+ $profileSku = " Standard_Microsoft" ;
31
+ New-AzCdnProfile - SkuName $profileSku - Name $cdnProfileName - ResourceGroupName $ResourceGroupName - Location Global
32
+
33
+ $endpointName = ' e-' + (RandomString - allChars $false - len 6 );
34
+ Write-Host - ForegroundColor Green " Create endpointName : $ ( $endpointName ) "
35
+
36
+ $location = " westus"
37
+ $origin = @ {
38
+ Name = " origin1"
39
+ HostName = " host1.hello.com"
40
+ };
41
+ $originId = " /subscriptions/$subId /resourcegroups/$ResourceGroupName /providers/Microsoft.Cdn/profiles/$cdnProfileName /endpoints/$endpointName /origins/$ ( $origin.Name ) "
42
+ $originGroup = @ {
43
+ Name = " originGroup1"
44
+ HealthProbeSettingProbeIntervalInSecond = 240
45
+ HealthProbeSettingProbePath = " /health.aspx"
46
+ HealthProbeSettingProbeProtocol = " Https"
47
+ HealthProbeSettingProbeRequestType = " GET"
48
+ Origin = @ (@ {
49
+ Id = $originId
50
+ })
51
+ }
52
+ $defaultOriginGroup = " /subscriptions/$subId /resourcegroups/$ResourceGroupName /providers/Microsoft.Cdn/profiles/$cdnProfileName /endpoints/$endpointName /origingroups/$ ( $originGroup.Name ) "
53
+ New-AzCdnEndpoint - Name $endpointName - ResourceGroupName $ResourceGroupName - ProfileName $cdnProfileName - Location $location `
54
+ - Origin $origin - OriginGroup $originGroup - DefaultOriginGroupId $defaultOriginGroup
55
+ $originGroups = Get-AzCdnOriginGroup - EndpointName $endpointName - ProfileName $cdnProfileName - ResourceGroupName $ResourceGroupName
56
+
57
+ $originGroups.Count | Should - Be 1
58
+ } Finally
59
+ {
60
+ Remove-AzResourceGroup - Name $ResourceGroupName - NoWait
61
+ }
62
+ } | Should -Not - Throw
20
63
}
21
64
22
- It ' Get' - skip {
23
- { throw [System.NotImplementedException ] } | Should -Not - Throw
65
+ It ' Get' {
66
+ {
67
+ $subId = $env.SubscriptionId
68
+ $ResourceGroupName = ' testps-rg-' + (RandomString - allChars $false - len 6 )
69
+ try
70
+ {
71
+ Write-Host - ForegroundColor Green " Create test group $ ( $ResourceGroupName ) "
72
+ New-AzResourceGroup - Name $ResourceGroupName - Location $env.location
73
+
74
+ $cdnProfileName = ' p-' + (RandomString - allChars $false - len 6 );
75
+ Write-Host - ForegroundColor Green " Use cdnProfileName : $ ( $cdnProfileName ) "
76
+
77
+ $profileSku = " Standard_Microsoft" ;
78
+ New-AzCdnProfile - SkuName $profileSku - Name $cdnProfileName - ResourceGroupName $ResourceGroupName - Location Global
79
+
80
+ $endpointName = ' e-' + (RandomString - allChars $false - len 6 );
81
+ Write-Host - ForegroundColor Green " Create endpointName : $ ( $endpointName ) "
82
+
83
+ $location = " westus"
84
+ $origin = @ {
85
+ Name = " origin1"
86
+ HostName = " host1.hello.com"
87
+ };
88
+ $originId = " /subscriptions/$subId /resourcegroups/$ResourceGroupName /providers/Microsoft.Cdn/profiles/$cdnProfileName /endpoints/$endpointName /origins/$ ( $origin.Name ) "
89
+ $originGroup = @ {
90
+ Name = " originGroup1"
91
+ HealthProbeSettingProbeIntervalInSecond = 240
92
+ HealthProbeSettingProbePath = " /health.aspx"
93
+ HealthProbeSettingProbeProtocol = " Https"
94
+ HealthProbeSettingProbeRequestType = " GET"
95
+ Origin = @ (@ {
96
+ Id = $originId
97
+ })
98
+ }
99
+ $defaultOriginGroup = " /subscriptions/$subId /resourcegroups/$ResourceGroupName /providers/Microsoft.Cdn/profiles/$cdnProfileName /endpoints/$endpointName /origingroups/$ ( $originGroup.Name ) "
100
+ New-AzCdnEndpoint - Name $endpointName - ResourceGroupName $ResourceGroupName - ProfileName $cdnProfileName - Location $location `
101
+ - Origin $origin - OriginGroup $originGroup - DefaultOriginGroupId $defaultOriginGroup
102
+ $endpointOriginGroup = Get-AzCdnOriginGroup - Name $originGroup.Name - EndpointName $endpointName - ProfileName $cdnProfileName - ResourceGroupName $ResourceGroupName
103
+
104
+ $endpointOriginGroup.Name | Should - Be $originGroup.Name
105
+ $endpointOriginGroup.HealthProbeSettingProbeIntervalInSecond | Should - Be $originGroup.HealthProbeSettingProbeIntervalInSecond
106
+ $endpointOriginGroup.HealthProbeSettingProbePath | Should - Be $originGroup.HealthProbeSettingProbePath
107
+ $endpointOriginGroup.HealthProbeSettingProbeProtocol | Should - Be $originGroup.HealthProbeSettingProbeProtocol
108
+ $endpointOriginGroup.HealthProbeSettingProbeRequestType | Should - Be $originGroup.HealthProbeSettingProbeRequestType
109
+ $endpointOriginGroup.Origin [0 ].Id | Should - Be $originGroup.Origin [0 ].Id
110
+ } Finally
111
+ {
112
+ Remove-AzResourceGroup - Name $ResourceGroupName - NoWait
113
+ }
114
+ } | Should -Not - Throw
24
115
}
25
116
26
- It ' GetViaIdentity' - skip {
27
- { throw [System.NotImplementedException ] } | Should -Not - Throw
117
+ It ' GetViaIdentity' {
118
+ {
119
+ $PSDefaultParameterValues [' Disabled' ] = $true
120
+ $subId = $env.SubscriptionId
121
+ $ResourceGroupName = ' testps-rg-' + (RandomString - allChars $false - len 6 )
122
+ try
123
+ {
124
+ Write-Host - ForegroundColor Green " Create test group $ ( $ResourceGroupName ) "
125
+ New-AzResourceGroup - Name $ResourceGroupName - Location $env.location
126
+
127
+ $cdnProfileName = ' p-' + (RandomString - allChars $false - len 6 );
128
+ Write-Host - ForegroundColor Green " Use cdnProfileName : $ ( $cdnProfileName ) "
129
+
130
+ $profileSku = " Standard_Microsoft" ;
131
+ New-AzCdnProfile - SkuName $profileSku - Name $cdnProfileName - ResourceGroupName $ResourceGroupName - Location Global
132
+
133
+ $endpointName = ' e-' + (RandomString - allChars $false - len 6 );
134
+ Write-Host - ForegroundColor Green " Create endpointName : $ ( $endpointName ) "
135
+
136
+ $location = " westus"
137
+ $origin = @ {
138
+ Name = " origin1"
139
+ HostName = " host1.hello.com"
140
+ };
141
+ $originId = " /subscriptions/$subId /resourcegroups/$ResourceGroupName /providers/Microsoft.Cdn/profiles/$cdnProfileName /endpoints/$endpointName /origins/$ ( $origin.Name ) "
142
+ $originGroup = @ {
143
+ Name = " originGroup1"
144
+ HealthProbeSettingProbeIntervalInSecond = 240
145
+ HealthProbeSettingProbePath = " /health.aspx"
146
+ HealthProbeSettingProbeProtocol = " Https"
147
+ HealthProbeSettingProbeRequestType = " GET"
148
+ Origin = @ (@ {
149
+ Id = $originId
150
+ })
151
+ }
152
+ $defaultOriginGroup = " /subscriptions/$subId /resourcegroups/$ResourceGroupName /providers/Microsoft.Cdn/profiles/$cdnProfileName /endpoints/$endpointName /origingroups/$ ( $originGroup.Name ) "
153
+ New-AzCdnEndpoint - Name $endpointName - ResourceGroupName $ResourceGroupName - ProfileName $cdnProfileName - Location $location `
154
+ - Origin $origin - OriginGroup $originGroup - DefaultOriginGroupId $defaultOriginGroup
155
+ $endpointOriginGroup = Get-AzCdnOriginGroup - Name $originGroup.Name - EndpointName $endpointName - ProfileName $cdnProfileName - ResourceGroupName $ResourceGroupName | Get-AzCdnOriginGroup
156
+
157
+ $endpointOriginGroup.Name | Should - Be $originGroup.Name
158
+ $endpointOriginGroup.HealthProbeSettingProbeIntervalInSecond | Should - Be $originGroup.HealthProbeSettingProbeIntervalInSecond
159
+ $endpointOriginGroup.HealthProbeSettingProbePath | Should - Be $originGroup.HealthProbeSettingProbePath
160
+ $endpointOriginGroup.HealthProbeSettingProbeProtocol | Should - Be $originGroup.HealthProbeSettingProbeProtocol
161
+ $endpointOriginGroup.HealthProbeSettingProbeRequestType | Should - Be $originGroup.HealthProbeSettingProbeRequestType
162
+ $endpointOriginGroup.Origin [0 ].Id | Should - Be $originGroup.Origin [0 ].Id
163
+ } Finally
164
+ {
165
+ Remove-AzResourceGroup - Name $ResourceGroupName - NoWait
166
+ }
167
+ } | Should -Not - Throw
28
168
}
29
169
}
0 commit comments