-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Az.Dns] Add NAPTR support and tests (#26239)
* Add NAPTR support and tests * Updated the test results * Update recordings and merge main * Update changelog and help sections for NAPTR record type * Updating signatures in staticanalysis exceptions and typo fixes in samples * Updated the typo in doc and updated the sdk version to 1.2.2 * Fix the changelog as per the documentation * Remove empty line --------- Co-authored-by: Sandeep Kadagathur Vadiraj <[email protected]>
- Loading branch information
1 parent
90206f7
commit 4f9e087
Showing
67 changed files
with
12,603 additions
and
11,576 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -534,6 +534,87 @@ function Test-RecordSetMXNonEmpty | |
Remove-AzResourceGroup -Name $resourceGroup.ResourceGroupName -Force | ||
} | ||
|
||
<# | ||
.SYNOPSIS | ||
Full Record Set CRUD cycle | ||
#> | ||
function Test-RecordSetNAPTR | ||
{ | ||
$zoneName = Get-RandomZoneName | ||
$recordName = getAssetname | ||
$resourceGroup = TestSetup-CreateResourceGroup | ||
$zone = $resourceGroup | New-AzDnsZone -Name $zoneName | ||
|
||
$record = $zone | New-AzDnsRecordSet -Name $recordName -Ttl 100 -RecordType NAPTR | ||
|
||
# add two records, remove one, remove another no-op | ||
$record = $record | Add-AzDnsRecordConfig -Order 10 -Preference 20 -Flags "U" -Services "SIP+D2U" -Regexp "" -Replacement "_sip._udp.example.com." | ||
$record = $record | Add-AzDnsRecordConfig -Order 20 -Preference 30 -Flags "A" -Services "EAU+SIP" -Regexp "!^.*$!mailto:[email protected]!" -Replacement "." | ||
$record = $record | Remove-AzDnsRecordConfig -Order 10 -Preference 20 -Flags "U" -Services "SIP+D2U" -Regexp "" -Replacement "_sip._udp.example.com." | ||
$record = $record | Remove-AzDnsRecordConfig -Order 30 -Preference 30 -Flags "A" -Services "EAU+SIP" -Regexp "!^.*$!mailto:[email protected]!" -Replacement "." | ||
|
||
$record | Set-AzDnsRecordSet | ||
$getResult = Get-AzDnsRecordSet -Name $recordName -ZoneName $zoneName -ResourceGroupName $resourceGroup.ResourceGroupName -RecordType NAPTR | ||
|
||
Assert-AreEqual 1 $getResult.Records.Count | ||
Assert-AreEqual 20 $getResult.Records[0].Order | ||
Assert-AreEqual 30 $getResult.Records[0].Preference | ||
Assert-AreEqual "A" $getResult.Records[0].Flags | ||
Assert-AreEqual "EAU+SIP" $getResult.Records[0].Services | ||
Assert-AreEqual "!^.*$!mailto:[email protected]!" $getResult.Records[0].Regexp | ||
Assert-AreEqual "." $getResult.Records[0].Replacement | ||
|
||
$listResult = Get-AzDnsRecordSet -ZoneName $zoneName -ResourceGroupName $resourceGroup.ResourceGroupName -RecordType NAPTR | ||
|
||
Assert-AreEqual 1 $listResult[0].Records.Count | ||
Assert-AreEqual 20 $getResult.Records[0].Order | ||
Assert-AreEqual 30 $getResult.Records[0].Preference | ||
Assert-AreEqual "A" $getResult.Records[0].Flags | ||
Assert-AreEqual "EAU+SIP" $getResult.Records[0].Services | ||
Assert-AreEqual "!^.*$!mailto:[email protected]!" $getResult.Records[0].Regexp | ||
Assert-AreEqual "." $getResult.Records[0].Replacement | ||
|
||
$removed = $listResult[0] | Remove-AzDnsRecordSet -Confirm:$false -PassThru | ||
|
||
Assert-True { $removed } | ||
|
||
Remove-AzDnsZone -Name $zoneName -ResourceGroupName $resourceGroup.ResourceGroupName -Confirm:$false | ||
Remove-AzResourceGroup -Name $resourceGroup.ResourceGroupName -Force | ||
} | ||
|
||
<# | ||
.SYNOPSIS | ||
Full Record Set CRUD cycle | ||
#> | ||
function Test-RecordSetNAPTRNonEmpty | ||
{ | ||
$zoneName = Get-RandomZoneName | ||
$recordName = getAssetname | ||
$resourceGroup = TestSetup-CreateResourceGroup | ||
$zone = $resourceGroup | New-AzDnsZone -Name $zoneName | ||
|
||
$records = @(); | ||
$records += New-AzDnsRecordConfig -Order 10 -Preference 20 -Flags "U" -Services "SIP+D2U" -Regexp "" -Replacement "_sip._udp.example.com." | ||
$record = $zone | New-AzDnsRecordSet -Name $recordName -Ttl 100 -RecordType NAPTR -DnsRecords $records | ||
|
||
$getResult = Get-AzDnsRecordSet -Name $recordName -ZoneName $zoneName -ResourceGroupName $resourceGroup.ResourceGroupName -RecordType NAPTR | ||
|
||
Assert-AreEqual 1 $getResult.Records.Count | ||
Assert-AreEqual 10 $getResult.Records[0].Order | ||
Assert-AreEqual 20 $getResult.Records[0].Preference | ||
Assert-AreEqual "U" $getResult.Records[0].Flags | ||
Assert-AreEqual "SIP+D2U" $getResult.Records[0].Services | ||
Assert-AreEqual "" $getResult.Records[0].Regexp | ||
Assert-AreEqual "_sip._udp.example.com." $getResult.Records[0].Replacement | ||
|
||
$removed = $getResult[0] | Remove-AzDnsRecordSet -Confirm:$false -PassThru | ||
|
||
Assert-True { $removed } | ||
|
||
Remove-AzDnsZone -Name $zoneName -ResourceGroupName $resourceGroup.ResourceGroupName -Confirm:$false | ||
Remove-AzResourceGroup -Name $resourceGroup.ResourceGroupName -Force | ||
} | ||
|
||
<# | ||
.SYNOPSIS | ||
Full Record Set CRUD cycle | ||
|
Oops, something went wrong.