Skip to content

Commit b51f9e4

Browse files
committed
private dns powershell changes
1 parent faabfab commit b51f9e4

21 files changed

+6716
-118
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@
6363
</Reference>
6464
<Reference Include="Microsoft.Azure.Management.Dns, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6565
<SpecificVersion>False</SpecificVersion>
66-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Dns.1.7.2-preview\lib\net45\Microsoft.Azure.Management.Dns.dll</HintPath>
66+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Dns.1.11.0-preview\lib\net452\Microsoft.Azure.Management.Dns.dll</HintPath>
67+
<Private>True</Private>
68+
</Reference>
69+
<Reference Include="Microsoft.Azure.Management.Network, Version=14.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
70+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.14.0.0-preview\lib\net452\Microsoft.Azure.Management.Network.dll</HintPath>
6771
<Private>True</Private>
6872
</Reference>
6973
<Reference Include="Microsoft.Azure.Management.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -104,7 +108,7 @@
104108
<Private>True</Private>
105109
</Reference>
106110
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.TestFramework">
107-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.5.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll</HintPath>
111+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.5.2\lib\net45\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll</HintPath>
108112
<Private>True</Private>
109113
</Reference>
110114
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ function Get-ResourceGroupName
2121
return getAssetName
2222
}
2323

24+
<#
25+
.SYNOPSIS
26+
Gets valid resource group name
27+
#>
28+
function Get-VirtualNetworkName
29+
{
30+
return getAssetName
31+
}
32+
2433
<#
2534
.SYNOPSIS
2635
Gets valid resource name
@@ -71,6 +80,18 @@ function TestSetup-CreateResourceGroup
7180
return $resourceGroup
7281
}
7382

83+
<#
84+
.SYNOPSIS
85+
Creates a resource group to use in tests
86+
#>
87+
function TestSetup-CreateVirtualNetwork ($resourceGroup)
88+
{
89+
$virtualNetworkName = Get-VirtualNetworkName
90+
$virtualNetwork = New-AzureRmVirtualNetwork -Name $virtualNetworkName -resourceGroupName $resourceGroup.ResourceGroupName -location "WestUS" -AddressPrefix "192.168.1.0/24"
91+
return $virtualNetwork
92+
}
93+
94+
7495
function Get-RandomZoneName
7596
{
7697
$prefix = getAssetName;

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

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
using System.Collections.Generic;
1616
using Microsoft.Azure.Commands.Common.Authentication;
17+
using Microsoft.Azure.Management.Network;
1718
using Microsoft.Azure.Test.HttpRecorder;
1819
using RestTestFramework = Microsoft.Rest.ClientRuntime.Azure.TestFramework;
1920

@@ -55,6 +56,8 @@ public class DnsTestsBase : RMTestBase
5556

5657
public DnsManagementClient DnsClient { get; private set; }
5758

59+
public NetworkManagementClient NetworkManagementClient { get; private set; }
60+
5861

5962
public static DnsTestsBase NewInstance
6063
{
@@ -77,15 +80,17 @@ protected void SetupManagementClients(MockContext context)
7780
this.SubscriptionClient = this.GetSubscriptionClient();
7881
this.GalleryClient = this.GetGalleryClient();
7982
this.AuthorizationManagementClient = this.GetAuthorizationManagementClient();
80-
this.DnsClient = this.GetFeatureClient(context);
83+
this.DnsClient = this.GetFeatureClient(context);
84+
this.NetworkManagementClient = this.GetNetworkManagementClient(context);
8185

8286

8387
this.helper.SetupManagementClients(
8488
this.ResourceManagementClient,
8589
this.SubscriptionClient,
8690
this.GalleryClient,
8791
this.AuthorizationManagementClient,
88-
this.DnsClient);
92+
this.DnsClient,
93+
this.NetworkManagementClient);
8994
}
9095

9196

@@ -133,12 +138,15 @@ public void RunPsTestWorkflow(
133138
}
134139

135140

136-
this.SetupManagementClients(context);
137-
141+
this.SetupManagementClients(context);
138142

139143
this.helper.SetupEnvironment(AzureModule.AzureResourceManager);
140144

141145

146+
147+
148+
149+
142150
string callingClassName = callingClassType
143151
.Split(new[] { "." }, StringSplitOptions.RemoveEmptyEntries)
144152
.Last();
@@ -178,6 +186,12 @@ protected ResourceManagementClient GetResourceManagementClient()
178186
return LegacyTest.TestBase.GetServiceClient<ResourceManagementClient>(this.csmTestFactory);
179187
}
180188

189+
protected NetworkManagementClient GetNetworkManagementClient(MockContext context)
190+
{
191+
return context.GetServiceClient<NetworkManagementClient>(TestEnvironmentFactory.GetTestEnvironment());
192+
}
193+
194+
181195
private AuthorizationManagementClient GetAuthorizationManagementClient()
182196
{
183197
return LegacyTest.TestBase.GetServiceClient<AuthorizationManagementClient>(this.csmTestFactory);

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ public void TestZoneCrud()
3131
DnsTestsBase.NewInstance.RunPowerShellTest("Test-ZoneCrud");
3232
}
3333

34+
[Fact]
35+
[Trait(Category.AcceptanceType, Category.CheckIn)]
36+
public void TestZoneCrudPrivateResolutionVnet()
37+
{
38+
DnsTestsBase.NewInstance.RunPowerShellTest("Test-ZoneCrudPrivateResolutionVnet");
39+
}
40+
41+
[Fact]
42+
[Trait(Category.AcceptanceType, Category.CheckIn)]
43+
public void TestZoneCrudPrivateRegistrationVnet()
44+
{
45+
DnsTestsBase.NewInstance.RunPowerShellTest("Test-ZoneCrudPrivateRegistrationVnet");
46+
}
47+
3448
[Fact]
3549
[Trait(Category.AcceptanceType, Category.CheckIn)]
3650
public void TestZoneCrudTrimsDot()

0 commit comments

Comments
 (0)