Skip to content

Commit 3d11417

Browse files
author
Chenglong Liu
committed
Update
1 parent 9d7a563 commit 3d11417

6 files changed

+307
-20
lines changed

src/Cdn/Cdn.Autorest/test/Get-AzCdnManagedRuleSet.Tests.ps1 renamed to src/Cdn/Cdn.Autorest/test/Get-AzFrontDoorCdnManagedRuleSet.Tests.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
if(($null -eq $TestName) -or ($TestName -contains 'Get-AzCdnManagedRuleSet'))
1+
if(($null -eq $TestName) -or ($TestName -contains 'Get-AzFrontDoorCdnManagedRuleSet'))
22
{
33
$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1'
44
if (-Not (Test-Path -Path $loadEnvPath)) {
55
$loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1'
66
}
77
. ($loadEnvPath)
8-
$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzCdnManagedRuleSet.Recording.json'
8+
$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzFrontDoorCdnManagedRuleSet.Recording.json'
99
$currentPath = $PSScriptRoot
1010
while(-not $mockingPath) {
1111
$mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File
@@ -14,7 +14,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzCdnManagedRuleSet'))
1414
. ($mockingPath | Select-Object -First 1).FullName
1515
}
1616

17-
Describe 'Get-AzCdnManagedRuleSet' {
17+
Describe 'Get-AzFrontDoorCdnManagedRuleSet' {
1818
It 'List' -skip {
1919
{ throw [System.NotImplementedException] } | Should -Not -Throw
2020
}

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

Lines changed: 111 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,121 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzFrontDoorCdnOrigin'))
1515
}
1616

1717
Describe 'Get-AzFrontDoorCdnOrigin' {
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+
Get-AzFrontDoorCdnOriginGroup -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName
42+
43+
$hostName = "en.wikipedia.org";
44+
$originName = 'ori' + (RandomString -allChars $false -len 6);
45+
New-AzFrontDoorCdnOrigin -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName `
46+
-OriginName $originName -OriginHostHeader $hostName -HostName $hostName `
47+
-HttpPort 80 -HttpsPort 443 -Priority 1 -Weight 1000
48+
49+
$origins = Get-AzFrontDoorCdnOrigin -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName
50+
$origins.Count | Should -Be 1
51+
} Finally
52+
{
53+
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
54+
}
2055
}
2156

22-
It 'Get' -skip {
23-
{ throw [System.NotImplementedException] } | Should -Not -Throw
57+
It 'Get' {
58+
$ResourceGroupName = 'testps-rg-' + (RandomString -allChars $false -len 6)
59+
try
60+
{
61+
Write-Host -ForegroundColor Green "Create test group $($ResourceGroupName)"
62+
New-AzResourceGroup -Name $ResourceGroupName -Location $env.location
63+
64+
$frontDoorCdnProfileName = 'fdp-' + (RandomString -allChars $false -len 6);
65+
Write-Host -ForegroundColor Green "Use frontDoorCdnProfileName : $($frontDoorCdnProfileName)"
66+
67+
$profileSku = "Standard_AzureFrontDoor";
68+
New-AzFrontDoorCdnProfile -SkuName $profileSku -Name $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Location Global
69+
70+
$originGroupName = 'org' + (RandomString -allChars $false -len 6);
71+
New-AzFrontDoorCdnOriginGroup -OriginGroupName $originGroupName -ProfileName $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName `
72+
-LoadBalancingSettingSampleSize 5 `
73+
-LoadBalancingSettingSuccessfulSamplesRequired 4 `
74+
-LoadBalancingSettingAdditionalLatencyInMillisecond 200 `
75+
-HealthProbeSettingProbeIntervalInSecond 1 `
76+
-HealthProbeSettingProbePath "/" `
77+
-HealthProbeSettingProbeProtocol $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.ProbeProtocol]::Https) `
78+
-HealthProbeSettingProbeRequestType $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.HealthProbeRequestType]::Get) `
79+
80+
Get-AzFrontDoorCdnOriginGroup -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName
81+
82+
$hostName = "en.wikipedia.org";
83+
$originName = 'ori' + (RandomString -allChars $false -len 6);
84+
New-AzFrontDoorCdnOrigin -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName `
85+
-OriginName $originName -OriginHostHeader $hostName -HostName $hostName `
86+
-HttpPort 80 -HttpsPort 443 -Priority 1 -Weight 1000
87+
88+
$origin = Get-AzFrontDoorCdnOrigin -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName -OriginName $originName
89+
$origin.Name | Should -Be $originName
90+
} Finally
91+
{
92+
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
93+
}
2494
}
2595

2696
It 'GetViaIdentity' -skip {
27-
{ throw [System.NotImplementedException] } | Should -Not -Throw
97+
$PSDefaultParameterValues['Disabled'] = $true
98+
$ResourceGroupName = 'testps-rg-' + (RandomString -allChars $false -len 6)
99+
try
100+
{
101+
Write-Host -ForegroundColor Green "Create test group $($ResourceGroupName)"
102+
New-AzResourceGroup -Name $ResourceGroupName -Location $env.location
103+
104+
$frontDoorCdnProfileName = 'fdp-' + (RandomString -allChars $false -len 6);
105+
Write-Host -ForegroundColor Green "Use frontDoorCdnProfileName : $($frontDoorCdnProfileName)"
106+
107+
$profileSku = "Standard_AzureFrontDoor";
108+
New-AzFrontDoorCdnProfile -SkuName $profileSku -Name $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Location Global
109+
110+
$originGroupName = 'org' + (RandomString -allChars $false -len 6);
111+
New-AzFrontDoorCdnOriginGroup -OriginGroupName $originGroupName -ProfileName $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName `
112+
-LoadBalancingSettingSampleSize 5 `
113+
-LoadBalancingSettingSuccessfulSamplesRequired 4 `
114+
-LoadBalancingSettingAdditionalLatencyInMillisecond 200 `
115+
-HealthProbeSettingProbeIntervalInSecond 1 `
116+
-HealthProbeSettingProbePath "/" `
117+
-HealthProbeSettingProbeProtocol $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.ProbeProtocol]::Https) `
118+
-HealthProbeSettingProbeRequestType $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.HealthProbeRequestType]::Get) `
119+
120+
Get-AzFrontDoorCdnOriginGroup -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName
121+
122+
$hostName = "en.wikipedia.org";
123+
$originName = 'ori' + (RandomString -allChars $false -len 6);
124+
New-AzFrontDoorCdnOrigin -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName `
125+
-OriginName $originName -OriginHostHeader $hostName -HostName $hostName `
126+
-HttpPort 80 -HttpsPort 443 -Priority 1 -Weight 1000
127+
128+
$origin = Get-AzFrontDoorCdnOrigin -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName -OriginName $originName | Get-AzFrontDoorCdnOrigin
129+
$origin.Name | Should -Be $originName
130+
} Finally
131+
{
132+
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
133+
}
28134
}
29135
}

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

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

1717
Describe 'New-AzFrontDoorCdnOrigin' {
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+
41+
Get-AzFrontDoorCdnOriginGroup -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName
42+
43+
$hostName = "en.wikipedia.org";
44+
$originName = 'ori' + (RandomString -allChars $false -len 6);
45+
New-AzFrontDoorCdnOrigin -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName `
46+
-OriginName $originName -OriginHostHeader $hostName -HostName $hostName `
47+
-HttpPort 80 -HttpsPort 443 -Priority 1 -Weight 1000
48+
} Finally
49+
{
50+
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
51+
}
2052
}
2153
}

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

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

1717
Describe 'Remove-AzFrontDoorCdnOrigin' {
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+
Get-AzFrontDoorCdnOriginGroup -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName
42+
43+
$hostName = "en.wikipedia.org";
44+
$originName = 'ori' + (RandomString -allChars $false -len 6);
45+
New-AzFrontDoorCdnOrigin -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName `
46+
-OriginName $originName -OriginHostHeader $hostName -HostName $hostName `
47+
-HttpPort 80 -HttpsPort 443 -Priority 1 -Weight 1000
48+
49+
Remove-AzFrontDoorCdnOrigin -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName -OriginName $originName
50+
} Finally
51+
{
52+
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
53+
}
2054
}
2155

22-
It 'DeleteViaIdentity' -skip {
23-
{ throw [System.NotImplementedException] } | Should -Not -Throw
56+
It 'DeleteViaIdentity' {
57+
$PSDefaultParameterValues['Disabled'] = $true
58+
$ResourceGroupName = 'testps-rg-' + (RandomString -allChars $false -len 6)
59+
try
60+
{
61+
Write-Host -ForegroundColor Green "Create test group $($ResourceGroupName)"
62+
New-AzResourceGroup -Name $ResourceGroupName -Location $env.location
63+
64+
$frontDoorCdnProfileName = 'fdp-' + (RandomString -allChars $false -len 6);
65+
Write-Host -ForegroundColor Green "Use frontDoorCdnProfileName : $($frontDoorCdnProfileName)"
66+
67+
$profileSku = "Standard_AzureFrontDoor";
68+
New-AzFrontDoorCdnProfile -SkuName $profileSku -Name $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Location Global
69+
70+
$originGroupName = 'org' + (RandomString -allChars $false -len 6);
71+
New-AzFrontDoorCdnOriginGroup -OriginGroupName $originGroupName -ProfileName $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName `
72+
-LoadBalancingSettingSampleSize 5 `
73+
-LoadBalancingSettingSuccessfulSamplesRequired 4 `
74+
-LoadBalancingSettingAdditionalLatencyInMillisecond 200 `
75+
-HealthProbeSettingProbeIntervalInSecond 1 `
76+
-HealthProbeSettingProbePath "/" `
77+
-HealthProbeSettingProbeProtocol $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.ProbeProtocol]::Https) `
78+
-HealthProbeSettingProbeRequestType $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.HealthProbeRequestType]::Get) `
79+
80+
Get-AzFrontDoorCdnOriginGroup -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName
81+
82+
$hostName = "en.wikipedia.org";
83+
$originName = 'ori' + (RandomString -allChars $false -len 6);
84+
New-AzFrontDoorCdnOrigin -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName `
85+
-OriginName $originName -OriginHostHeader $hostName -HostName $hostName `
86+
-HttpPort 80 -HttpsPort 443 -Priority 1 -Weight 1000
87+
88+
Get-AzFrontDoorCdnOrigin -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName -OriginName $originName | Remove-AzFrontDoorCdnOrigin
89+
} Finally
90+
{
91+
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
92+
}
2493
}
2594
}

0 commit comments

Comments
 (0)