Skip to content

Commit 9b9a19d

Browse files
author
Chenglong Liu
committed
Add tests
1 parent ec836cf commit 9b9a19d

5 files changed

+101
-9
lines changed

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

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,30 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzFrontDoorCdnEndpointRes
1515
}
1616

1717
Describe 'Get-AzFrontDoorCdnEndpointResourceUsage' {
18-
It 'List' -skip {
19-
{ throw [System.NotImplementedException] } | Should -Not -Throw
18+
It 'List' {
19+
{
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+
$endpointUsage = Get-AzFrontDoorCdnEndpointResourceUsage -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -EndpointName $endpointName
37+
$endpointUsage | Should -not -BeNullOrEmpty
38+
} Finally
39+
{
40+
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
41+
}
42+
} | Should -Not -Throw
2043
}
2144
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Describe 'Get-AzFrontDoorCdnOrigin' {
9393
}
9494
}
9595

96-
It 'GetViaIdentity' -skip {
96+
It 'GetViaIdentity' {
9797
$PSDefaultParameterValues['Disabled'] = $true
9898
$ResourceGroupName = 'testps-rg-' + (RandomString -allChars $false -len 6)
9999
try

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

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

1717
Describe 'Get-AzFrontDoorCdnOriginGroupResourceUsage' {
18-
It 'List' -skip {
19-
{ throw [System.NotImplementedException] } | Should -Not -Throw
18+
It 'List' {
19+
{
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+
$originGroupName = 'org' + (RandomString -allChars $false -len 6);
33+
New-AzFrontDoorCdnOriginGroup -OriginGroupName $originGroupName -ProfileName $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName `
34+
-LoadBalancingSettingSampleSize 5 `
35+
-LoadBalancingSettingSuccessfulSamplesRequired 4 `
36+
-LoadBalancingSettingAdditionalLatencyInMillisecond 200 `
37+
-HealthProbeSettingProbeIntervalInSecond 1 `
38+
-HealthProbeSettingProbePath "/" `
39+
-HealthProbeSettingProbeProtocol $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.ProbeProtocol]::Https) `
40+
-HealthProbeSettingProbeRequestType $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.HealthProbeRequestType]::Get) `
41+
42+
$originGroupUsage = Get-AzFrontDoorCdnOriginGroupResourceUsage -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName
43+
$originGroupUsage | Should -not -BeNullOrEmpty
44+
} Finally
45+
{
46+
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
47+
}
48+
} | Should -Not -Throw
2049
}
2150
}

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

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

1717
Describe 'Get-AzFrontDoorCdnProfileResourceUsage' {
18-
It 'List' -skip {
19-
{ throw [System.NotImplementedException] } | Should -Not -Throw
18+
It 'List' {
19+
{
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+
$frontDoorCdnProfileUsage = Get-AzFrontDoorCdnProfileResourceUsage -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName
33+
$frontDoorCdnProfileUsage | Should -not -BeNullOrEmpty
34+
} Finally
35+
{
36+
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
37+
}
38+
} | Should -Not -Throw
2039
}
2140
}

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

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,28 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzFrontDoorCdnRuleSetReso
1515
}
1616

1717
Describe 'Get-AzFrontDoorCdnRuleSetResourceUsage' {
18-
It 'List' -skip {
19-
{ throw [System.NotImplementedException] } | Should -Not -Throw
18+
It 'List' {
19+
{
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+
$rulesetName = 'rs' + (RandomString -allChars $false -len 6);
33+
New-AzFrontDoorCdnRuleSet -ProfileName $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Name $rulesetName
34+
$rulesetUsage = Get-AzFrontDoorCdnRuleSetResourceUsage -ProfileName $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -RuleSetName $rulesetName
35+
$rulesetUsage | Should -not -BeNullOrEmpty
36+
} Finally
37+
{
38+
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
39+
}
40+
} | Should -Not -Throw
2041
}
2142
}

0 commit comments

Comments
 (0)