Skip to content

Commit 15a17fd

Browse files
authored
Merge pull request #1 from ZianWang02/feature/Cdn
Add New-AzCdnEndpoint test
2 parents d6bc468 + 317bb03 commit 15a17fd

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

src/Cdn/Cdn.Autorest/test/New-AzCdnEndpoint.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 'New-AzCdnEndpoint'))
1515
}
1616

1717
Describe 'New-AzCdnEndpoint' {
18-
It 'CreateExpanded' -skip {
19-
{ throw [System.NotImplementedException] } | Should -Not -Throw
18+
It 'CreateExpanded' {
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+
$cdnProfileName = 'p-' + (RandomString -allChars $false -len 6);
27+
Write-Host -ForegroundColor Green "Use cdnProfileName : $($cdnProfileName)"
28+
29+
$profileSku = "Standard_Microsoft";
30+
New-AzCdnProfile -SkuName $profileSku -Name $cdnProfileName -ResourceGroupName $ResourceGroupName -Location Global
31+
32+
$endpointName = 'e-' + (RandomString -allChars $false -len 6);
33+
$origin = @{
34+
Name = "origin1"
35+
HostName = "host1.hello.com"
36+
};
37+
Write-Host -ForegroundColor Green "Create endpointName : $($endpointName), origin.Name : $($origin.Name), origin.HostName : $($origin.HostName)"
38+
39+
$endpoint = New-AzCdnEndpoint -Name $endpointName -ResourceGroupName $ResourceGroupName -ProfileName $cdnProfileName -Location $env.location -Origin $origin
40+
$endpoint.Name | Should -Be $endpointName
41+
$endpoint.Location | Should -Be $env.location
42+
$endpoint.Origin.Name | Should -Be $origin.Name
43+
$endpoint.Origin.HostName | Should -Be $origin.HostName
44+
} Finally
45+
{
46+
Remove-AzResourceGroup -Name $ResourceGroupName -NoWait
47+
}
48+
} | Should -Not -Throw
2049
}
2150
}

0 commit comments

Comments
 (0)