Skip to content

Commit c4dc718

Browse files
committed
Fix DNS PowerShell tests
1 parent e735ed7 commit c4dc718

28 files changed

+2509
-3032
lines changed

src/ResourceManager/Dns/Commands.Dns.Test/Commands.Dns.Test.csproj

Lines changed: 5 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@
6161
<SpecificVersion>False</SpecificVersion>
6262
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.18.0-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6363
</Reference>
64+
<Reference Include="Microsoft.Azure.Management.Dns, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
65+
<SpecificVersion>False</SpecificVersion>
66+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Dns.1.2.1-preview\lib\net40\Microsoft.Azure.Management.Dns.dll</HintPath>
67+
</Reference>
6468
<Reference Include="Microsoft.Azure.Monitoring, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6569
<SpecificVersion>False</SpecificVersion>
6670
<HintPath>..\..\..\packages\Microsoft.Azure.Monitoring.2.2.1-preview\lib\net40\Microsoft.Azure.Monitoring.dll</HintPath>
@@ -191,76 +195,7 @@
191195
<None Include="ScenarioTests\Common.ps1">
192196
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
193197
</None>
194-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetA.json">
195-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
196-
</None>
197-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetAAAA.json">
198-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
199-
</None>
200-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetAddRecordTypeMismatch.json">
201-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
202-
</None>
203-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetAddTwoCnames.json">
204-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
205-
</None>
206-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetCNAME.json">
207-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
208-
</None>
209-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetCrud.json">
210-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
211-
</None>
212-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetCrudWithPiping.json">
213-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
214-
</None>
215-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetEtagMismatch.json">
216-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
217-
</None>
218-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetGet.json">
219-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
220-
</None>
221-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetGetWithEndsWith.json">
222-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
223-
</None>
224-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetMX.json">
225-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
226-
</None>
227-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetNS.json">
228-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
229-
</None>
230-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetRemoveRecordTypeMismatch.json">
231-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
232-
</None>
233-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetSOA.json">
234-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
235-
</None>
236-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetSRV.json">
237-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
238-
</None>
239-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetTXT.json">
240-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
241-
</None>
242-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestZoneCrud.json">
243-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
244-
</None>
245-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestZoneCrudWithPiping.json">
246-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
247-
</None>
248-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestZoneList.json">
249-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
250-
</None>
251-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestZoneListWithEndsWith.json">
252-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
253-
</None>
254-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestZoneRemoveEtagMismatch.json">
255-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
256-
</None>
257-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestZoneRemoveNotFound.json">
258-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
259-
</None>
260-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestZoneSetEtagMismatch.json">
261-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
262-
</None>
263-
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestZoneSetNotFound.json">
198+
<None Include="SessionRecords\**\*.json">
264199
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
265200
</None>
266201
</ItemGroup>

src/ResourceManager/Dns/Commands.Dns.Test/ScenarioTests/DnsTestsBase.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.ScenarioTest.DnsTests
2323
using Microsoft.Azure.Subscriptions.Csm;
2424
using Microsoft.Azure.Test;
2525
using Microsoft.WindowsAzure.Commands.ScenarioTest;
26-
using Microsoft.Azure.Commands.Dns.Models;
26+
using Microsoft.Azure.Management.Dns;
2727

2828

2929
public class DnsTestsBase
@@ -46,7 +46,7 @@ public class DnsTestsBase
4646
public AuthorizationManagementClient AuthorizationManagementClient { get; private set; }
4747

4848

49-
public DnsClient DnsClient { get; private set; }
49+
public DnsManagementClient DnsClient { get; private set; }
5050

5151

5252
public static DnsTestsBase NewInstance
@@ -182,12 +182,12 @@ private SubscriptionClient GetSubscriptionClient()
182182
private GalleryClient GetGalleryClient()
183183
{
184184
return TestBase.GetServiceClient<GalleryClient>(this.csmTestFactory);
185-
}
185+
}
186186

187187

188-
private DnsClient GetFeatureClient()
189-
{
190-
return TestBase.GetServiceClient<DnsClient>(this.csmTestFactory);
188+
private DnsManagementClient GetFeatureClient()
189+
{
190+
return TestBase.GetServiceClient<DnsManagementClient>(this.csmTestFactory);
191191
}
192192
}
193193
}

src/ResourceManager/Dns/Commands.Dns.Test/ScenarioTests/RecordsTests.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ function Test-RecordSetNewAlreadyExists
447447
$record = $zone | New-AzureDnsRecordSet -Name $recordName -Ttl 100 -RecordType A | Add-AzureDnsRecordConfig -Ipv4Address 1.2.9.8
448448

449449
# error the second time
450-
Assert-Throws { $zone | New-AzureDnsRecordSet -Name $recordName -Ttl 212 -RecordType A } "PreconditionFailed: The condition '*' in the If-None-Match header was not satisfied."
450+
Assert-Throws { $zone | New-AzureDnsRecordSet -Name $recordName -Ttl 212 -RecordType A } "PreconditionFailed: The condition '*' in the If-None-Match header was not satisfied. The current was 'n/a'."
451451

452452
$zone | New-AzureDnsRecordSet -Name $recordName -Ttl 999 -RecordType A -Overwrite -Force
453453

@@ -525,16 +525,17 @@ function Test-RecordSetEtagMismatch
525525
$zoneName = getAssetname
526526
$recordName = getAssetname
527527
$recordSet = TestSetup-CreateResourceGroup | New-AzureDnsZone -Name $zoneName | New-AzureDnsRecordSet -Name $recordName -Ttl 100 -RecordType AAAA
528+
$originalEtag = $recordSet.Etag
528529
$recordSet.Etag = "gibberish"
529530

530-
Assert-Throws { $recordSet | Set-AzureDnsRecordSet } "PreconditionFailed: The condition 'gibberish' in the If-Match header was not satisfied."
531+
Assert-Throws { $recordSet | Set-AzureDnsRecordSet } "PreconditionFailed: The condition 'gibberish' in the If-Match header was not satisfied. The current was '$originalEtag'."
531532

532533
$updatedRecordSet = $recordSet | Set-AzureDnsRecordSet -Overwrite
533534

534535
Assert-AreNotEqual "gibberish" $updatedRecordSet.Etag
535536
Assert-AreNotEqual $recordSet.Etag $updatedRecordSet.Etag
536537

537-
Assert-Throws { $recordSet | Remove-AzureDnsRecordSet -Force } "PreconditionFailed: The condition 'gibberish' in the If-Match header was not satisfied."
538+
Assert-Throws { $recordSet | Remove-AzureDnsRecordSet -Force } "PreconditionFailed: The condition 'gibberish' in the If-Match header was not satisfied. The current was '$($updatedRecordSet.Etag)'."
538539

539540
Assert-True { $recordSet | Remove-AzureDnsRecordSet -Overwrite -Force -PassThru }
540541

src/ResourceManager/Dns/Commands.Dns.Test/ScenarioTests/ZoneTests.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function Test-ZoneNewAlreadyExists
106106
$resourceGroupName = $createdZone.ResourceGroupName
107107
Assert-NotNull $createdZone
108108

109-
Assert-Throws { New-AzureDnsZone -Name $zoneName -ResourceGroupName $resourceGroupName } "PreconditionFailed: The condition '*' in the If-None-Match header was not satisfied."
109+
Assert-Throws { New-AzureDnsZone -Name $zoneName -ResourceGroupName $resourceGroupName } "PreconditionFailed: The condition '*' in the If-None-Match header was not satisfied. The current was 'n/a'."
110110

111111
$createdZone | Remove-AzureDnsZone -PassThru -Force
112112
}
@@ -122,7 +122,7 @@ function Test-ZoneSetEtagMismatch
122122
$originalEtag = $createdZone.Etag
123123
$createdZone.Etag = "gibberish"
124124

125-
Assert-Throws { $createdZone | Set-AzureDnsZone } "PreconditionFailed: The condition 'gibberish' in the If-Match header was not satisfied."
125+
Assert-Throws { $createdZone | Set-AzureDnsZone } "PreconditionFailed: The condition 'gibberish' in the If-Match header was not satisfied. The current was '$originalEtag'."
126126

127127
$updatedZone = $createdZone | Set-AzureDnsZone -Overwrite
128128

@@ -141,7 +141,7 @@ function Test-ZoneSetNotFound
141141
$zoneName = getAssetname
142142
$resourceGroup = TestSetup-CreateResourceGroup
143143

144-
Assert-Throws { Set-AzureDnsZone -Name $zoneName -ResourceGroupName $resourceGroup.ResourceGroupName } "PreconditionFailed: The condition '*' in the If-Match header was not satisfied."
144+
Assert-Throws { Set-AzureDnsZone -Name $zoneName -ResourceGroupName $resourceGroup.ResourceGroupName } "PreconditionFailed: The condition '*' in the If-Match header was not satisfied. The current was 'n/a'."
145145
}
146146

147147
<#
@@ -155,7 +155,7 @@ function Test-ZoneRemoveEtagMismatch
155155
$originalEtag = $createdZone.Etag
156156
$createdZone.Etag = "gibberish"
157157

158-
Assert-Throws { $createdZone | Remove-AzureDnsZone -Force } "PreconditionFailed: The condition 'gibberish' in the If-Match header was not satisfied."
158+
Assert-Throws { $createdZone | Remove-AzureDnsZone -Force } "PreconditionFailed: The condition 'gibberish' in the If-Match header was not satisfied. The current was '$originalEtag'."
159159

160160
$removed = $createdZone | Remove-AzureDnsZone -Overwrite -Force -PassThru
161161

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests/TestRecordSetA.json

Lines changed: 116 additions & 116 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests/TestRecordSetAAAA.json

Lines changed: 117 additions & 117 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests/TestRecordSetAddRecordTypeMismatch.json

Lines changed: 82 additions & 82 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests/TestRecordSetAddTwoCnames.json

Lines changed: 83 additions & 83 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests/TestRecordSetCNAME.json

Lines changed: 116 additions & 116 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests/TestRecordSetCrud.json

Lines changed: 114 additions & 114 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests/TestRecordSetCrudWithPiping.json

Lines changed: 115 additions & 115 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests/TestRecordSetEtagMismatch.json

Lines changed: 118 additions & 118 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests/TestRecordSetGet.json

Lines changed: 169 additions & 628 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests/TestRecordSetGetWithEndsWith.json

Lines changed: 150 additions & 150 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests/TestRecordSetMX.json

Lines changed: 116 additions & 116 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests/TestRecordSetNS.json

Lines changed: 113 additions & 113 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests/TestRecordSetRemoveRecordTypeMismatch.json

Lines changed: 81 additions & 81 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests/TestRecordSetSOA.json

Lines changed: 111 additions & 111 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests/TestRecordSetSRV.json

Lines changed: 117 additions & 117 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests/TestRecordSetTXT.json

Lines changed: 116 additions & 116 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests/TestZoneCrud.json

Lines changed: 100 additions & 100 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests/TestZoneCrudWithPiping.json

Lines changed: 129 additions & 129 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests/TestZoneList.json

Lines changed: 93 additions & 93 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests/TestZoneListWithEndsWith.json

Lines changed: 80 additions & 80 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests/TestZoneRemoveEtagMismatch.json

Lines changed: 69 additions & 69 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests/TestZoneRemoveNotFound.json

Lines changed: 47 additions & 47 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests/TestZoneSetEtagMismatch.json

Lines changed: 85 additions & 85 deletions
Large diffs are not rendered by default.

src/ResourceManager/Dns/Commands.Dns.Test/SessionRecords/Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests/TestZoneSetNotFound.json

Lines changed: 53 additions & 53 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)