Skip to content

Commit 9d7a563

Browse files
author
Chenglong Liu
committed
Add AzFrontDoorCdnOriginGroup test
1 parent ed93844 commit 9d7a563

6 files changed

+298
-21
lines changed

src/Cdn/Cdn.Autorest/test/Get-AzFrontDoorCdnOriginGroup.Tests.ps1

Lines changed: 88 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,97 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzFrontDoorCdnOriginGroup
1515
}
1616

1717
Describe 'Get-AzFrontDoorCdnOriginGroup' {
18-
It 'List' -skip {
19-
{ throw [System.NotImplementedException] } | Should -Not -Throw
18+
It 'List' {
19+
$ResourceGroupName = 'testps-rg-' + (RandomString -allChars $false -len 6)
20+
try
21+
{
22+
Write-Host -ForegroundColor Green "Create test group $($ResourceGroupName)"
23+
New-AzResourceGroup -Name $ResourceGroupName -Location $env.location
24+
25+
$frontDoorCdnProfileName = 'fdp-' + (RandomString -allChars $false -len 6);
26+
Write-Host -ForegroundColor Green "Use frontDoorCdnProfileName : $($frontDoorCdnProfileName)"
27+
28+
$profileSku = "Standard_AzureFrontDoor";
29+
New-AzFrontDoorCdnProfile -SkuName $profileSku -Name $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Location Global
30+
31+
$originGroupName = 'org' + (RandomString -allChars $false -len 6);
32+
New-AzFrontDoorCdnOriginGroup -OriginGroupName $originGroupName -ProfileName $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName `
33+
-LoadBalancingSettingSampleSize 5 `
34+
-LoadBalancingSettingSuccessfulSamplesRequired 4 `
35+
-LoadBalancingSettingAdditionalLatencyInMillisecond 200 `
36+
-HealthProbeSettingProbeIntervalInSecond 1 `
37+
-HealthProbeSettingProbePath "/" `
38+
-HealthProbeSettingProbeProtocol $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.ProbeProtocol]::Https) `
39+
-HealthProbeSettingProbeRequestType $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.HealthProbeRequestType]::Get) `
40+
41+
$originGroups = Get-AzFrontDoorCdnOriginGroup -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName
42+
$originGroups.Count | Should -Be 1
43+
} Finally
44+
{
45+
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
46+
}
2047
}
2148

22-
It 'Get' -skip {
23-
{ throw [System.NotImplementedException] } | Should -Not -Throw
49+
It 'Get' {
50+
$ResourceGroupName = 'testps-rg-' + (RandomString -allChars $false -len 6)
51+
try
52+
{
53+
Write-Host -ForegroundColor Green "Create test group $($ResourceGroupName)"
54+
New-AzResourceGroup -Name $ResourceGroupName -Location $env.location
55+
56+
$frontDoorCdnProfileName = 'fdp-' + (RandomString -allChars $false -len 6);
57+
Write-Host -ForegroundColor Green "Use frontDoorCdnProfileName : $($frontDoorCdnProfileName)"
58+
59+
$profileSku = "Standard_AzureFrontDoor";
60+
New-AzFrontDoorCdnProfile -SkuName $profileSku -Name $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Location Global
61+
62+
$originGroupName = 'org' + (RandomString -allChars $false -len 6);
63+
New-AzFrontDoorCdnOriginGroup -OriginGroupName $originGroupName -ProfileName $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName `
64+
-LoadBalancingSettingSampleSize 5 `
65+
-LoadBalancingSettingSuccessfulSamplesRequired 4 `
66+
-LoadBalancingSettingAdditionalLatencyInMillisecond 200 `
67+
-HealthProbeSettingProbeIntervalInSecond 1 `
68+
-HealthProbeSettingProbePath "/" `
69+
-HealthProbeSettingProbeProtocol $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.ProbeProtocol]::Https) `
70+
-HealthProbeSettingProbeRequestType $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.HealthProbeRequestType]::Get) `
71+
72+
$originGroup = Get-AzFrontDoorCdnOriginGroup -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName
73+
$originGroup.Name | Should -Be $originGroupName
74+
} Finally
75+
{
76+
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
77+
}
2478
}
2579

26-
It 'GetViaIdentity' -skip {
27-
{ throw [System.NotImplementedException] } | Should -Not -Throw
80+
It 'GetViaIdentity' {
81+
$PSDefaultParameterValues['Disabled'] = $true
82+
$ResourceGroupName = 'testps-rg-' + (RandomString -allChars $false -len 6)
83+
try
84+
{
85+
Write-Host -ForegroundColor Green "Create test group $($ResourceGroupName)"
86+
New-AzResourceGroup -Name $ResourceGroupName -Location $env.location
87+
88+
$frontDoorCdnProfileName = 'fdp-' + (RandomString -allChars $false -len 6);
89+
Write-Host -ForegroundColor Green "Use frontDoorCdnProfileName : $($frontDoorCdnProfileName)"
90+
91+
$profileSku = "Standard_AzureFrontDoor";
92+
New-AzFrontDoorCdnProfile -SkuName $profileSku -Name $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Location Global
93+
94+
$originGroupName = 'org' + (RandomString -allChars $false -len 6);
95+
New-AzFrontDoorCdnOriginGroup -OriginGroupName $originGroupName -ProfileName $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName `
96+
-LoadBalancingSettingSampleSize 5 `
97+
-LoadBalancingSettingSuccessfulSamplesRequired 4 `
98+
-LoadBalancingSettingAdditionalLatencyInMillisecond 200 `
99+
-HealthProbeSettingProbeIntervalInSecond 1 `
100+
-HealthProbeSettingProbePath "/" `
101+
-HealthProbeSettingProbeProtocol $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.ProbeProtocol]::Https) `
102+
-HealthProbeSettingProbeRequestType $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.HealthProbeRequestType]::Get) `
103+
104+
$originGroup = Get-AzFrontDoorCdnOriginGroup -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName | Get-AzFrontDoorCdnOriginGroup
105+
$originGroup.Name | Should -Be $originGroupName
106+
} Finally
107+
{
108+
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
109+
}
28110
}
29111
}

src/Cdn/Cdn.Autorest/test/New-AzFrontDoorCdnOriginGroup.Tests.ps1

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,31 @@ if(($null -eq $TestName) -or ($TestName -contains 'New-AzFrontDoorCdnOriginGroup
1515
}
1616

1717
Describe 'New-AzFrontDoorCdnOriginGroup' {
18-
It 'CreateExpanded' -skip {
19-
{ throw [System.NotImplementedException] } | Should -Not -Throw
18+
It 'CreateExpanded' {
19+
$ResourceGroupName = 'testps-rg-' + (RandomString -allChars $false -len 6)
20+
try
21+
{
22+
Write-Host -ForegroundColor Green "Create test group $($ResourceGroupName)"
23+
New-AzResourceGroup -Name $ResourceGroupName -Location $env.location
24+
25+
$frontDoorCdnProfileName = 'fdp-' + (RandomString -allChars $false -len 6);
26+
Write-Host -ForegroundColor Green "Use frontDoorCdnProfileName : $($frontDoorCdnProfileName)"
27+
28+
$profileSku = "Standard_AzureFrontDoor";
29+
New-AzFrontDoorCdnProfile -SkuName $profileSku -Name $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Location Global
30+
31+
$originGroupName = 'org' + (RandomString -allChars $false -len 6);
32+
New-AzFrontDoorCdnOriginGroup -OriginGroupName $originGroupName -ProfileName $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName `
33+
-LoadBalancingSettingSampleSize 5 `
34+
-LoadBalancingSettingSuccessfulSamplesRequired 4 `
35+
-LoadBalancingSettingAdditionalLatencyInMillisecond 200 `
36+
-HealthProbeSettingProbeIntervalInSecond 1 `
37+
-HealthProbeSettingProbePath "/" `
38+
-HealthProbeSettingProbeProtocol $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.ProbeProtocol]::Https) `
39+
-HealthProbeSettingProbeRequestType $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.HealthProbeRequestType]::Get) `
40+
} Finally
41+
{
42+
#Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
43+
}
2044
}
2145
}

src/Cdn/Cdn.Autorest/test/Remove-AzFrontDoorCdnOriginGroup.Tests.ps1

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,65 @@ if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzFrontDoorCdnOriginGr
1515
}
1616

1717
Describe 'Remove-AzFrontDoorCdnOriginGroup' {
18-
It 'Delete' -skip {
19-
{ throw [System.NotImplementedException] } | Should -Not -Throw
18+
It 'Delete' {
19+
$ResourceGroupName = 'testps-rg-' + (RandomString -allChars $false -len 6)
20+
try
21+
{
22+
Write-Host -ForegroundColor Green "Create test group $($ResourceGroupName)"
23+
New-AzResourceGroup -Name $ResourceGroupName -Location $env.location
24+
25+
$frontDoorCdnProfileName = 'fdp-' + (RandomString -allChars $false -len 6);
26+
Write-Host -ForegroundColor Green "Use frontDoorCdnProfileName : $($frontDoorCdnProfileName)"
27+
28+
$profileSku = "Standard_AzureFrontDoor";
29+
New-AzFrontDoorCdnProfile -SkuName $profileSku -Name $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Location Global
30+
31+
$originGroupName = 'org' + (RandomString -allChars $false -len 6);
32+
New-AzFrontDoorCdnOriginGroup -OriginGroupName $originGroupName -ProfileName $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName `
33+
-LoadBalancingSettingSampleSize 5 `
34+
-LoadBalancingSettingSuccessfulSamplesRequired 4 `
35+
-LoadBalancingSettingAdditionalLatencyInMillisecond 200 `
36+
-HealthProbeSettingProbeIntervalInSecond 1 `
37+
-HealthProbeSettingProbePath "/" `
38+
-HealthProbeSettingProbeProtocol $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.ProbeProtocol]::Https) `
39+
-HealthProbeSettingProbeRequestType $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.HealthProbeRequestType]::Get) `
40+
41+
$originGroup = Get-AzFrontDoorCdnOriginGroup -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName
42+
Remove-AzFrontDoorCdnOriginGroup -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName
43+
} Finally
44+
{
45+
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
46+
}
2047
}
2148

22-
It 'DeleteViaIdentity' -skip {
23-
{ throw [System.NotImplementedException] } | Should -Not -Throw
49+
It 'DeleteViaIdentity' {
50+
$PSDefaultParameterValues['Disabled'] = $true
51+
$ResourceGroupName = 'testps-rg-' + (RandomString -allChars $false -len 6)
52+
try
53+
{
54+
Write-Host -ForegroundColor Green "Create test group $($ResourceGroupName)"
55+
New-AzResourceGroup -Name $ResourceGroupName -Location $env.location
56+
57+
$frontDoorCdnProfileName = 'fdp-' + (RandomString -allChars $false -len 6);
58+
Write-Host -ForegroundColor Green "Use frontDoorCdnProfileName : $($frontDoorCdnProfileName)"
59+
60+
$profileSku = "Standard_AzureFrontDoor";
61+
New-AzFrontDoorCdnProfile -SkuName $profileSku -Name $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Location Global
62+
63+
$originGroupName = 'org' + (RandomString -allChars $false -len 6);
64+
New-AzFrontDoorCdnOriginGroup -OriginGroupName $originGroupName -ProfileName $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName `
65+
-LoadBalancingSettingSampleSize 5 `
66+
-LoadBalancingSettingSuccessfulSamplesRequired 4 `
67+
-LoadBalancingSettingAdditionalLatencyInMillisecond 200 `
68+
-HealthProbeSettingProbeIntervalInSecond 1 `
69+
-HealthProbeSettingProbePath "/" `
70+
-HealthProbeSettingProbeProtocol $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.ProbeProtocol]::Https) `
71+
-HealthProbeSettingProbeRequestType $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.HealthProbeRequestType]::Get) `
72+
73+
Get-AzFrontDoorCdnOriginGroup -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName | Remove-AzFrontDoorCdnOriginGroup
74+
} Finally
75+
{
76+
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
77+
}
2478
}
2579
}

src/Cdn/Cdn.Autorest/test/Update-AzFrontDoorCdnEndpoint.Tests.ps1

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,59 @@ if(($null -eq $TestName) -or ($TestName -contains 'Update-AzFrontDoorCdnEndpoint
1515
}
1616

1717
Describe 'Update-AzFrontDoorCdnEndpoint' {
18-
It 'UpdateExpanded' -skip {
19-
{ throw [System.NotImplementedException] } | Should -Not -Throw
18+
It 'UpdateExpanded' {
19+
$PSDefaultParameterValues['Disabled'] = $true
20+
$ResourceGroupName = 'testps-rg-' + (RandomString -allChars $false -len 6)
21+
try
22+
{
23+
Write-Host -ForegroundColor Green "Create test group $($ResourceGroupName)"
24+
New-AzResourceGroup -Name $ResourceGroupName -Location $env.location
25+
26+
$frontDoorCdnProfileName = 'fdp-' + (RandomString -allChars $false -len 6);
27+
Write-Host -ForegroundColor Green "Use frontDoorCdnProfileName : $($frontDoorCdnProfileName)"
28+
29+
$profileSku = "Standard_AzureFrontDoor";
30+
New-AzFrontDoorCdnProfile -SkuName $profileSku -Name $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Location Global
31+
32+
$endpointName = 'end-' + (RandomString -allChars $false -len 6);
33+
Write-Host -ForegroundColor Green "Use frontDoorCdnEndpointName : $($endpointName)"
34+
New-AzFrontDoorCdnEndpoint -EndpointName $endpointName -ProfileName $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Location Global
35+
36+
$endpoint = Get-AzFrontdoorCdnEndpoint -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -EndpointName $endpointName
37+
$endpoint.EnabledState | Should -Be "Enabled"
38+
39+
Update-AzFrontdoorCdnEndpoint -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -EndpointName $endpointName -EnabledState "Disabled"
40+
$updatedEndpoint = Get-AzFrontdoorCdnEndpoint -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -EndpointName $endpointName
41+
$updatedEndpoint.EnabledState | Should -Be "Disabled"
42+
} Finally
43+
{
44+
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
45+
}
2046
}
2147

22-
It 'UpdateViaIdentityExpanded' -skip {
23-
{ throw [System.NotImplementedException] } | Should -Not -Throw
48+
It 'UpdateViaIdentityExpanded' {
49+
$ResourceGroupName = 'testps-rg-' + (RandomString -allChars $false -len 6)
50+
try
51+
{
52+
Write-Host -ForegroundColor Green "Create test group $($ResourceGroupName)"
53+
New-AzResourceGroup -Name $ResourceGroupName -Location $env.location
54+
55+
$frontDoorCdnProfileName = 'fdp-' + (RandomString -allChars $false -len 6);
56+
Write-Host -ForegroundColor Green "Use frontDoorCdnProfileName : $($frontDoorCdnProfileName)"
57+
58+
$profileSku = "Standard_AzureFrontDoor";
59+
New-AzFrontDoorCdnProfile -SkuName $profileSku -Name $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Location Global
60+
61+
$endpointName = 'end-' + (RandomString -allChars $false -len 6);
62+
Write-Host -ForegroundColor Green "Use frontDoorCdnEndpointName : $($endpointName)"
63+
New-AzFrontDoorCdnEndpoint -EndpointName $endpointName -ProfileName $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Location Global
64+
65+
Get-AzFrontdoorCdnEndpoint -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -EndpointName $endpointName | Update-AzFrontdoorCdnEndpoint -EnabledState "Disabled"
66+
$updatedEndpoint = Get-AzFrontdoorCdnEndpoint -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -EndpointName $endpointName
67+
$updatedEndpoint.EnabledState | Should -Be "Disabled"
68+
} Finally
69+
{
70+
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
71+
}
2472
}
2573
}

0 commit comments

Comments
 (0)