Skip to content

Commit

Permalink
Merge pull request #1 from ZianWang02/feature/Cdn
Browse files Browse the repository at this point in the history
Add New-AzCdnEndpoint test
  • Loading branch information
ChenglongLiu authored Mar 16, 2022
2 parents d6bc468 + 317bb03 commit 15a17fd
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions src/Cdn/Cdn.Autorest/test/New-AzCdnEndpoint.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,36 @@ if(($null -eq $TestName) -or ($TestName -contains 'New-AzCdnEndpoint'))
}

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

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

$profileSku = "Standard_Microsoft";
New-AzCdnProfile -SkuName $profileSku -Name $cdnProfileName -ResourceGroupName $ResourceGroupName -Location Global

$endpointName = 'e-' + (RandomString -allChars $false -len 6);
$origin = @{
Name = "origin1"
HostName = "host1.hello.com"
};
Write-Host -ForegroundColor Green "Create endpointName : $($endpointName), origin.Name : $($origin.Name), origin.HostName : $($origin.HostName)"

$endpoint = New-AzCdnEndpoint -Name $endpointName -ResourceGroupName $ResourceGroupName -ProfileName $cdnProfileName -Location $env.location -Origin $origin
$endpoint.Name | Should -Be $endpointName
$endpoint.Location | Should -Be $env.location
$endpoint.Origin.Name | Should -Be $origin.Name
$endpoint.Origin.HostName | Should -Be $origin.HostName
} Finally
{
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
}
} | Should -Not -Throw
}
}

0 comments on commit 15a17fd

Please sign in to comment.