Skip to content

Commit 41b0556

Browse files
authored
Add parameter DomainNameLabelScope for PublicIpAddress (Azure#22052)
* add optional parameter domain name label scope for public ip address * add test record file and fix error * change domainNameLabelScope to enum * fix test * revert according to comments * change ValidateSet attribute
1 parent eee1ae2 commit 41b0556

File tree

8 files changed

+1364
-1
lines changed

8 files changed

+1364
-1
lines changed

src/Network/Network.Test/ScenarioTests/PublicIpAddressTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ public void TestPublicIpAddressCRUDStaticAllocation()
5757
TestRunner.RunTestScript("Test-PublicIpAddressCRUD-StaticAllocation");
5858
}
5959

60+
[Fact]
61+
[Trait(Category.AcceptanceType, Category.CheckIn)]
62+
[Trait(Category.Owner, NrpTeamAlias.wanrpdev)]
63+
public void TestPublicIpAddressCRUDWithDomainNameLabelScope()
64+
{
65+
TestRunner.RunTestScript("Test-PublicIpAddressCRUD-WithDomainNameLabelScope");
66+
}
67+
6068
[Fact]
6169
[Trait(Category.AcceptanceType, Category.CheckIn)]
6270
[Trait(Category.Owner, NrpTeamAlias.wanrpdev)]

src/Network/Network.Test/ScenarioTests/PublicIpAddressTests.ps1

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,50 @@ function Test-PublicIpAddressCRUD-StaticAllocation
186186
}
187187
}
188188

189+
<#
190+
.SYNOPSIS
191+
Tests creating new simple publicIpAddress with DomainNameLabelScope.
192+
#>
193+
function Test-PublicIpAddressCRUD-WithDomainNameLabelScope
194+
{
195+
# Setup
196+
$rgname = Get-ResourceGroupName
197+
$rname = Get-ResourceName
198+
$domainNameLabel = Get-ResourceName
199+
$domainNameLabelScope = "tenantreuse"
200+
$rglocation = "eastus2euap"
201+
$resourceTypeParent = "Microsoft.Network/publicIpAddresses"
202+
203+
try
204+
{
205+
# Create the resource group
206+
$resourceGroup = New-AzResourceGroup -Name $rgname -Location $rglocation -Tags @{ testtag = "testval" }
207+
208+
# Create publicIpAddres
209+
$actual = New-AzPublicIpAddress -ResourceGroupName $rgname -name $rname -location $rglocation -AllocationMethod Static -DomainNameLabel $domainNameLabel -DomainNameLabelScope $domainNameLabelScope
210+
$publicip = Get-AzPublicIpAddress -ResourceGroupName $rgname -name $rname
211+
Assert-AreEqual $publicip.ResourceGroupName $actual.ResourceGroupName
212+
Assert-AreEqual $publicip.Name $actual.Name
213+
Assert-AreEqual $publicip.Location $actual.Location
214+
Assert-AreEqual "Static" $publicip.PublicIpAllocationMethod
215+
Assert-AreEqual "Succeeded" $publicip.ProvisioningState
216+
Assert-AreEqual $domainNameLabel $publicip.DnsSettings.DomainNameLabel
217+
Assert-AreEqual $domainNameLabelScope $publicip.DnsSettings.DomainNameLabelScope
218+
219+
# delete
220+
$delete = Remove-AzPublicIpAddress -ResourceGroupName $actual.ResourceGroupName -name $rname -PassThru -Force
221+
Assert-AreEqual true $delete
222+
223+
$list = Get-AzPublicIpAddress -ResourceGroupName $actual.ResourceGroupName
224+
Assert-AreEqual 0 @($list).Count
225+
}
226+
finally
227+
{
228+
# Cleanup
229+
Clean-ResourceGroup $rgname
230+
}
231+
}
232+
189233
<#
190234
.SYNOPSIS
191235
Tests edit the domain name label of a publicIpAddress.

0 commit comments

Comments
 (0)