Skip to content

Commit

Permalink
Merge pull request #17 from ChenglongLiu/feature/Cdndev
Browse files Browse the repository at this point in the history
Add tests
  • Loading branch information
ChenglongLiu authored Apr 1, 2022
2 parents 42eac38 + 9b9a19d commit 64e28bd
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,30 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzFrontDoorCdnEndpointRes
}

Describe 'Get-AzFrontDoorCdnEndpointResourceUsage' {
It 'List' -skip {
{ throw [System.NotImplementedException] } | Should -Not -Throw
It 'List' {
{
$ResourceGroupName = 'testps-rg-' + (RandomString -allChars $false -len 6)
try
{
Write-Host -ForegroundColor Green "Create test group $($ResourceGroupName)"
New-AzResourceGroup -Name $ResourceGroupName -Location $env.location

$frontDoorCdnProfileName = 'fdp-' + (RandomString -allChars $false -len 6);
Write-Host -ForegroundColor Green "Use frontDoorCdnProfileName : $($frontDoorCdnProfileName)"

$profileSku = "Standard_AzureFrontDoor";
New-AzFrontDoorCdnProfile -SkuName $profileSku -Name $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Location Global

$endpointName = 'end-' + (RandomString -allChars $false -len 6);
Write-Host -ForegroundColor Green "Use frontDoorCdnEndpointName : $($endpointName)"
New-AzFrontDoorCdnEndpoint -EndpointName $endpointName -ProfileName $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Location Global

$endpointUsage = Get-AzFrontDoorCdnEndpointResourceUsage -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -EndpointName $endpointName
$endpointUsage | Should -not -BeNullOrEmpty
} Finally
{
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
}
} | Should -Not -Throw
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Describe 'Get-AzFrontDoorCdnOrigin' {
}
}

It 'GetViaIdentity' -skip {
It 'GetViaIdentity' {
$PSDefaultParameterValues['Disabled'] = $true
$ResourceGroupName = 'testps-rg-' + (RandomString -allChars $false -len 6)
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,36 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzFrontDoorCdnOriginGroup
}

Describe 'Get-AzFrontDoorCdnOriginGroupResourceUsage' {
It 'List' -skip {
{ throw [System.NotImplementedException] } | Should -Not -Throw
It 'List' {
{
$ResourceGroupName = 'testps-rg-' + (RandomString -allChars $false -len 6)
try
{
Write-Host -ForegroundColor Green "Create test group $($ResourceGroupName)"
New-AzResourceGroup -Name $ResourceGroupName -Location $env.location

$frontDoorCdnProfileName = 'fdp-' + (RandomString -allChars $false -len 6);
Write-Host -ForegroundColor Green "Use frontDoorCdnProfileName : $($frontDoorCdnProfileName)"

$profileSku = "Standard_AzureFrontDoor";
New-AzFrontDoorCdnProfile -SkuName $profileSku -Name $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Location Global

$originGroupName = 'org' + (RandomString -allChars $false -len 6);
New-AzFrontDoorCdnOriginGroup -OriginGroupName $originGroupName -ProfileName $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName `
-LoadBalancingSettingSampleSize 5 `
-LoadBalancingSettingSuccessfulSamplesRequired 4 `
-LoadBalancingSettingAdditionalLatencyInMillisecond 200 `
-HealthProbeSettingProbeIntervalInSecond 1 `
-HealthProbeSettingProbePath "/" `
-HealthProbeSettingProbeProtocol $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.ProbeProtocol]::Https) `
-HealthProbeSettingProbeRequestType $([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.HealthProbeRequestType]::Get) `

$originGroupUsage = Get-AzFrontDoorCdnOriginGroupResourceUsage -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName -OriginGroupName $originGroupName
$originGroupUsage | Should -not -BeNullOrEmpty
} Finally
{
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
}
} | Should -Not -Throw
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,26 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzFrontDoorCdnProfileReso
}

Describe 'Get-AzFrontDoorCdnProfileResourceUsage' {
It 'List' -skip {
{ throw [System.NotImplementedException] } | Should -Not -Throw
It 'List' {
{
$ResourceGroupName = 'testps-rg-' + (RandomString -allChars $false -len 6)
try
{
Write-Host -ForegroundColor Green "Create test group $($ResourceGroupName)"
New-AzResourceGroup -Name $ResourceGroupName -Location $env.location

$frontDoorCdnProfileName = 'fdp-' + (RandomString -allChars $false -len 6);
Write-Host -ForegroundColor Green "Use frontDoorCdnProfileName : $($frontDoorCdnProfileName)"

$profileSku = "Standard_AzureFrontDoor";
New-AzFrontDoorCdnProfile -SkuName $profileSku -Name $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Location Global

$frontDoorCdnProfileUsage = Get-AzFrontDoorCdnProfileResourceUsage -ResourceGroupName $ResourceGroupName -ProfileName $frontDoorCdnProfileName
$frontDoorCdnProfileUsage | Should -not -BeNullOrEmpty
} Finally
{
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
}
} | Should -Not -Throw
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,28 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzFrontDoorCdnRuleSetReso
}

Describe 'Get-AzFrontDoorCdnRuleSetResourceUsage' {
It 'List' -skip {
{ throw [System.NotImplementedException] } | Should -Not -Throw
It 'List' {
{
$ResourceGroupName = 'testps-rg-' + (RandomString -allChars $false -len 6)
try
{
Write-Host -ForegroundColor Green "Create test group $($ResourceGroupName)"
New-AzResourceGroup -Name $ResourceGroupName -Location $env.location

$frontDoorCdnProfileName = 'fdp-' + (RandomString -allChars $false -len 6);
Write-Host -ForegroundColor Green "Use frontDoorCdnProfileName : $($frontDoorCdnProfileName)"

$profileSku = "Standard_AzureFrontDoor";
New-AzFrontDoorCdnProfile -SkuName $profileSku -Name $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Location Global

$rulesetName = 'rs' + (RandomString -allChars $false -len 6);
New-AzFrontDoorCdnRuleSet -ProfileName $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -Name $rulesetName
$rulesetUsage = Get-AzFrontDoorCdnRuleSetResourceUsage -ProfileName $frontDoorCdnProfileName -ResourceGroupName $ResourceGroupName -RuleSetName $rulesetName
$rulesetUsage | Should -not -BeNullOrEmpty
} Finally
{
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
}
} | Should -Not -Throw
}
}

0 comments on commit 64e28bd

Please sign in to comment.