Skip to content

Azure RM Dns Bug Fixes and Update to Help File #2835

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
Sep 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
199e44b
Add updates to Dns help file xml
Aug 18, 2016
95f9f91
Remove force as paramaeter and set confirm impact to high
Aug 19, 2016
026f49f
Iterate through result before Write Object
Aug 19, 2016
d154287
Add test to verify can add record without naming RecordSet
Aug 19, 2016
8f1547f
Fix bug to expose NumRecord Sets and MaxNumRecordSets
Aug 4, 2016
24c4b9e
Added comments to DnsZone
Aug 4, 2016
5a859d0
add test to add and remove records from zone
Aug 8, 2016
f85bb6b
successfully add a record to zone and check recordsets
Aug 8, 2016
42342e5
Modify test to both add and remove record set and test NumberOfRecord…
Aug 9, 2016
55a9438
Create new error message for if SOA record is created
Aug 12, 2016
e71a7d0
Add error handling for if record type is SOA
Aug 12, 2016
d950c33
Add New-AzureRmDnsRecordSet test to Test-RecordSetSOA when record typ…
Aug 12, 2016
8603347
Add new error for zone name in suffix issue
Aug 15, 2016
1f91de7
Add test case to verify if Record Name ends with Zone Name
Aug 15, 2016
aad7cce
Add test case to ensure warning appears/does not interrupt workflow
Aug 15, 2016
e65a073
Merge branch 'helpfileUpdate' into AugustCojaco
Aug 19, 2016
4f5d9f5
Merge branch 'ConfirmBug' into AugustCojaco
Aug 19, 2016
80ec1b6
Merge branch 'NumRecordSetsBugFix6059441' into AugustCojaco
Aug 19, 2016
1c0920c
Merge branch 'SOABugFix5600833' into AugustCojaco
Aug 19, 2016
50e7306
Merge branch 'suffixZoneNameBugFix3172031' into AugustCojaco
Aug 19, 2016
a510eb5
Fixes error & adds tests when Piping RecordSet is not explicitly named
Aug 19, 2016
1e7ccb1
Change -Force to -Confirm:$false in all tests
Aug 19, 2016
e03a6fe
Merge change to -Force/-Confirm and fix conflicts
Aug 19, 2016
1751a3c
Minor fix to new tests from -Force to -Confirm:$false
Aug 19, 2016
2606e68
Modify DNS cmdlets to remove Should Continue and add Should Process a…
Aug 22, 2016
70d0564
Resolve Merge conflicts so all RecordsTests use -Confirm:$false inste…
Aug 22, 2016
624c813
Add new prompts to resources
Aug 22, 2016
34a3d0d
Add ConfirmAction to cmdlets
Aug 22, 2016
f2ef2eb
Add Bug ID for future reference
Aug 22, 2016
f0b3a4d
Fix spacing
Aug 23, 2016
6df090a
Adds minor fix where tests have all passed on production endpoint
Aug 29, 2016
c7b894f
Merge branch 'dev' into SeptemberCojaco
Aug 30, 2016
395437b
Fix PR to change ConfirmAction Overload and add JSON files for tests
Aug 30, 2016
f5d7c03
Add Force params back in and add obsolete because of breaking change
Aug 31, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,12 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetTXTNonEmpty.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetEndsWithZoneName.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetNewRecordNoName.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestZoneCrud.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -348,6 +354,9 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestZoneSetNotFound.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestZoneAddRemoveRecordSet.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup />
<ItemGroup>
Expand All @@ -357,4 +366,4 @@
</EmbeddedResource>
</ItemGroup>
Copy link
Member

@markcowl markcowl Aug 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like the new test recordings are added here. You will need new test recordings for the added testats and you'll need to add these explicitly, with 'Copy If Newer' or 'Copy Always' property

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -229,5 +229,18 @@ public void TestRecordSetGet()
{
DnsTestsBase.NewInstance.RunPowerShellTest("Test-RecordSetGet");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRecordSetEndsWithZoneName()
{
DnsTestsBase.NewInstance.RunPowerShellTest("Test-RecordSetEndsWithZoneName");
}
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRecordSetNewRecordNoName()
{
DnsTestsBase.NewInstance.RunPowerShellTest("Test-RecordSetNewRecordNoName");
}
}
}
182 changes: 118 additions & 64 deletions src/ResourceManager/Dns/Commands.Dns.Test/ScenarioTests/RecordsTests.ps1

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,12 @@ public void TestZoneRemoveNotFound()
{
DnsTestsBase.NewInstance.RunPowerShellTest("Test-ZoneRemoveNonExisting");
}

[Fact()]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestZoneAddRemoveRecordSet()
{
DnsTestsBase.NewInstance.RunPowerShellTest("Test-AddRemoveRecordSet");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ function Test-ZoneCrud
Assert-AreEqual $zoneName $createdZone.Name
Assert-AreEqual $resourceGroup.ResourceGroupName $createdZone.ResourceGroupName
Assert-AreEqual 1 $createdZone.Tags.Count
Assert-AreEqual 2 $createdZone.NumberOfRecordSets
Assert-AreNotEqual $createdZone.NumberOfRecordSets $createdZone.MaxNumberOfRecordSets


$retrievedZone = Get-AzureRmDnsZone -Name $zoneName -ResourceGroupName $resourceGroup.ResourceGroupName

Expand All @@ -36,6 +39,9 @@ function Test-ZoneCrud
Assert-AreEqual $resourceGroup.ResourceGroupName $retrievedZone.ResourceGroupName
Assert-AreEqual $retrievedZone.Etag $createdZone.Etag
Assert-AreEqual 1 $retrievedZone.Tags.Count
Assert-AreEqual $createdZone.NumberOfRecordSets $retrievedZone.NumberOfRecordSets
# broken by bug RDBug #6993514
#Assert-AreEqual $createdZone.MaxNumberOfRecordSets $retrievedZone.MaxNumberOfRecordSets

$updatedZone = Set-AzureRmDnsZone -Name $zoneName -ResourceGroupName $resourceGroup.ResourceGroupName -Tags @{tag1="value1";tag2="value2"}

Expand All @@ -55,7 +61,7 @@ function Test-ZoneCrud
Assert-AreEqual $retrievedZone.Etag $updatedZone.Etag
Assert-AreEqual 2 $retrievedZone.Tags.Count

$removed = Remove-AzureRmDnsZone -Name $zoneName -ResourceGroupName $resourceGroup.ResourceGroupName -PassThru -Force
$removed = Remove-AzureRmDnsZone -Name $zoneName -ResourceGroupName $resourceGroup.ResourceGroupName -PassThru -Confirm:$false

Assert-True { $removed }

Expand Down Expand Up @@ -86,7 +92,7 @@ function Test-ZoneCrudTrimsDot
Assert-NotNull $updatedZone
Assert-AreEqual $zoneName $updatedZone.Name

$removed = Remove-AzureRmDnsZone -Name $zoneNameWithDot -ResourceGroupName $resourceGroup.ResourceGroupName -PassThru -Force
$removed = Remove-AzureRmDnsZone -Name $zoneNameWithDot -ResourceGroupName $resourceGroup.ResourceGroupName -PassThru -Confirm:$false

Assert-True { $removed }

Expand Down Expand Up @@ -119,7 +125,7 @@ function Test-ZoneCrudWithPiping
Assert-AreNotEqual $updatedZone.Etag $createdZone.Etag
Assert-AreEqual 0 $updatedZone.Tags.Count

$removed = Get-AzureRmDnsZone -Name $zoneName -ResourceGroupName $resourceGroupName | Remove-AzureRmDnsZone -PassThru -Force
$removed = Get-AzureRmDnsZone -Name $zoneName -ResourceGroupName $resourceGroupName | Remove-AzureRmDnsZone -PassThru -Confirm:$false

Assert-True { $removed }

Expand Down Expand Up @@ -147,7 +153,7 @@ function Test-ZoneCrudWithPipingTrimsDot
Assert-NotNull $updatedZone
Assert-AreEqual $zoneName $updatedZone.Name

$removed = $zoneObjectWithDot | Remove-AzureRmDnsZone -Overwrite -PassThru -Force
$removed = $zoneObjectWithDot | Remove-AzureRmDnsZone -Overwrite -PassThru -Confirm:$false

Assert-True { $removed }

Expand All @@ -168,7 +174,7 @@ function Test-ZoneNewAlreadyExists
$message = [System.String]::Format("The Zone {0} exists already and hence cannot be created again.", $zoneName);
Assert-Throws { New-AzureRmDnsZone -Name $zoneName -ResourceGroupName $resourceGroupName } $message

$createdZone | Remove-AzureRmDnsZone -PassThru -Force
$createdZone | Remove-AzureRmDnsZone -PassThru -Confirm:$false
}

<#
Expand All @@ -190,7 +196,7 @@ function Test-ZoneSetEtagMismatch
Assert-AreNotEqual "gibberish" $updatedZone.Etag
Assert-AreNotEqual $createdZone.Etag $updatedZone.Etag

$updatedZone | Remove-AzureRmDnsZone -PassThru -Force
$updatedZone | Remove-AzureRmDnsZone -PassThru -Confirm:$false
}

<#
Expand Down Expand Up @@ -218,9 +224,9 @@ function Test-ZoneRemoveEtagMismatch
$createdZone.Etag = "gibberish"

$message = [System.String]::Format("The Zone {0} has been modified (etag mismatch).", $zoneName);
Assert-Throws { $createdZone | Remove-AzureRmDnsZone -Force } $message
Assert-Throws { $createdZone | Remove-AzureRmDnsZone -Confirm:$false } $message

$removed = $createdZone | Remove-AzureRmDnsZone -Overwrite -Force -PassThru
$removed = $createdZone | Remove-AzureRmDnsZone -Overwrite -Confirm:$false -PassThru

Assert-True { $removed }
}
Expand All @@ -234,7 +240,7 @@ function Test-ZoneRemoveNonExisting
$zoneName = Get-RandomZoneName
$resourceGroup = TestSetup-CreateResourceGroup

$removed = Remove-AzureRmDnsZone -Name $zoneName -ResourceGroupName $resourceGroup.ResourceGroupName -Force -PassThru
$removed = Remove-AzureRmDnsZone -Name $zoneName -ResourceGroupName $resourceGroup.ResourceGroupName -Confirm:$false -PassThru
}

<#
Expand Down Expand Up @@ -263,7 +269,7 @@ function Test-ZoneList
Assert-NotNull $resourceGroup.ResourceGroupName $result[1].ResourceGroupName
Assert-AreEqual 0 $result[1].Tags.Count

$result | Remove-AzureRmDnsZone -PassThru -Force
$result | Remove-AzureRmDnsZone -PassThru -Confirm:$false
}

function Test-ZoneListSubscription
Expand All @@ -278,8 +284,8 @@ function Test-ZoneListSubscription

Assert-True { $result.Count -ge 2 }

$createdZone1 | Remove-AzureRmDnsZone -PassThru -Force
$createdZone2 | Remove-AzureRmDnsZone -PassThru -Force
$createdZone1 | Remove-AzureRmDnsZone -PassThru -Confirm:$false
$createdZone2 | Remove-AzureRmDnsZone -PassThru -Confirm:$false
}

<#
Expand All @@ -303,6 +309,27 @@ function Test-ZoneListWithEndsWith
Assert-AreEqual $createdZone2.Etag $result[0].Etag
Assert-AreEqual $createdZone2.Name $result[0].Name
Assert-NotNull $resourceGroup.ResourceGroupName $result[0].ResourceGroupName
$result | Remove-AzureRmDnsZone -PassThru -Confirm:$false
}

<#
.SYNOPSIS
Add and Remove RecordSet from Zone and test NumberOfRecordSets
#>
function Test-AddRemoveRecordSet
{
$zoneName = Get-RandomZoneName
$recordName = getAssetname
$resourceGroup = TestSetup-CreateResourceGroup
$createdZone = New-AzureRmDnsZone -Name $zoneName -ResourceGroupName $resourceGroup.ResourceGroupName -Tags @{Name="tag1";Value="value1"}

$record = $createdZone | New-AzureRmDnsRecordSet -Name $recordName -Ttl 100 -RecordType A -DnsRecords @() | Add-AzureRmDnsRecordConfig -Ipv4Address 1.1.1.1 | Set-AzureRmDnsRecordSet
$updatedZone = Get-AzureRmDnsZone -ResourceGroupName $resourceGroup.ResourceGroupName -Name $zoneName
Assert-AreEqual 3 $updatedZone.NumberOfRecordSets

$removeRecord = $updatedZone | Get-AzureRmDnsRecordSet -Name $recordName -RecordType A | Remove-AzureRmDnsRecordSet -Name $recordName -RecordType A -PassThru -Confirm:$false
$finalZone = Get-AzureRmDnsZone -ResourceGroupName $resourceGroup.ResourceGroupName -Name $zoneName
Assert-AreEqual 2 $finalZone.NumberOfRecordSets

$result | Remove-AzureRmDnsZone -PassThru -Force
$finalZone | Remove-AzureRmDnsZone -PassThru -Confirm:$false
}
Loading