Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion TestMappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@
".\\src\\ResourceManager\\Network\\Commands.Network.Test\\bin\\Debug\\Microsoft.Azure.Commands.Network.Test.dll",
".\\src\\ResourceManager\\RecoveryServices.Backup\\Commands.RecoveryServices.Backup.Test\\bin\\Debug\\Microsoft.Azure.Commands.RecoveryServices.Backup.Test.dll",
".\\src\\ResourceManager\\ServiceFabric\\Commands.ServiceFabric.Test\\bin\\Debug\\Microsoft.Azure.Commands.ServiceFabric.Test.dll",
".\\src\\ResourceManager\\Sql\\Commands.Sql.Test\\bin\\Debug\\Microsoft.Azure.Commands.Sql.Test.dll"
".\\src\\ResourceManager\\Sql\\Commands.Sql.Test\\bin\\Debug\\Microsoft.Azure.Commands.Sql.Test.dll",
".\\src\\ResourceManager\\Dns\\Commands.Dns.Test\\bin\\Debug\\Microsoft.Azure.Commands.Dns.Test.dll"
],
"src/ResourceManager/NotificationHubs /": [
".\\src\\ResourceManager\\NotificationHubs\\Commands.NotificationHubs.Test\\bin\\Debug\\Microsoft.Azure.Commands.NotificationHubs.Test.dll"
Expand Down
10 changes: 5 additions & 5 deletions src/ResourceManager/Dns/AzureRM.Dns.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ NestedModules = @('.\Microsoft.Azure.Commands.Dns.dll')
FunctionsToExport = @()

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = 'Get-AzureRmDnsRecordSet', 'New-AzureRmDnsRecordConfig',
'Remove-AzureRmDnsRecordSet', 'Set-AzureRmDnsRecordSet',
'Remove-AzureRmDnsRecordConfig', 'Add-AzureRmDnsRecordConfig',
'New-AzureRmDnsRecordSet', 'Get-AzureRmDnsZone',
CmdletsToExport = 'Get-AzureRmDnsRecordSet', 'New-AzureRmDnsRecordConfig',
'Remove-AzureRmDnsRecordSet', 'Set-AzureRmDnsRecordSet',
'Remove-AzureRmDnsRecordConfig', 'Add-AzureRmDnsRecordConfig',
'New-AzureRmDnsRecordSet', 'Get-AzureRmDnsZone',
'Remove-AzureRmDnsZone', 'Set-AzureRmDnsZone', 'New-AzureRmDnsZone'

# Variables to export from this module
Expand Down Expand Up @@ -123,7 +123,7 @@ PrivateData = @{
# ExternalModuleDependencies = @()

} # End of PSData hashtable

} # End of PrivateData hashtable

# HelpInfo URI of this module
Expand Down
4 changes: 3 additions & 1 deletion src/ResourceManager/Dns/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
- Additional information about change #1
-->
## Current Release
* Support for Private DNS Zones (Public Preview)
- Adds ability to create DNS zones that are visible only to the associated virtual networks

## Version 4.0.1
* Added ResourceGroup Completer to -ResourceGroup parameters allowing tab completion through resource groups in current subscription

## Version 4.0.0
* Support for CAA record types in Azure DNS
- Supports all operations on CAA record type
- Supports all operations on CAA record type
* Add support for online help
- Run Get-Help with the -Online parameter to open the online help in your default Internet browser

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@
</Reference>
<Reference Include="Microsoft.Azure.Management.Dns, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Dns.2.0.0-preview\lib\net452\Microsoft.Azure.Management.Dns.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Dns.2.2.0-preview\lib\net452\Microsoft.Azure.Management.Dns.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.Network, Version=17.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Copy link
Member

Choose a reason for hiding this comment

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

@muwaqar if your test project is going to depend on the Network SDK, then you should update the Network entry in the TestMappings.json file with a reference to the Dns test project so these tests get run whenever a change in Network is made

<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.17.0.0-preview\lib\net452\Microsoft.Azure.Management.Network.dll</HintPath>
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to add your new test here - follow the structure of the other json files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't get this. Can you clarify?

Copy link
Contributor

Choose a reason for hiding this comment

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

Look at line 240 in this file, and create a new entry for each of your new json files generated for new tests, and add a line so that each of them is copied to the output directory.

<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand Down Expand Up @@ -191,6 +196,10 @@
<Project>{d3804b64-c0d3-48f8-82ec-1f632f833c9e}</Project>
<Name>Commands.Common.Authentication</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Common\Commands.Common.Network\Commands.Common.Network.csproj">
<Project>{1338f7ae-7111-4ed3-8916-2d0fecc876f4}</Project>
<Name>Commands.Common.Network</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Common\Commands.Common\Commands.Common.csproj">
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
<Name>Commands.Common</Name>
Expand Down Expand Up @@ -331,6 +340,21 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.RecordsTests\TestRecordSetNewRecordNoName.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestPrivateZoneCrud.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestPrivateZoneCrudByVirtualNetworkIds.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestPrivateZoneCrudByVirtualNetworkObjects.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestPrivateZoneCrudRegistrationVirtualNetwork.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestPrivateZoneCrudResolutionVirtualNetwork.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestZoneCrud.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
49 changes: 35 additions & 14 deletions src/ResourceManager/Dns/Commands.Dns.Test/ScenarioTests/Common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ function Get-ResourceName
return getAssetName
}

<#
.SYNOPSIS
Gets valid virtual network name
#>
function Get-VirtualNetworkName
{
return getAssetName
}

<#
.SYNOPSIS
Gets the default location for a provider
Expand All @@ -38,21 +47,21 @@ function Get-ProviderLocation($provider)
{
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)
{
$namespace = $provider.Split("/")[0]
if($provider.Contains("/"))
{
$type = $provider.Substring($namespace.Length + 1)
$location = Get-AzureRmResourceProvider -ProviderNamespace $namespace | where {$_.ResourceTypes[0].ResourceTypeName -eq $type}
if ($location -eq $null)
{
return "West US"
} else
{
return $location.Locations[0]
}
$namespace = $provider.Split("/")[0]
if($provider.Contains("/"))
{
$type = $provider.Substring($namespace.Length + 1)
$location = Get-AzureRmResourceProvider -ProviderNamespace $namespace | where {$_.ResourceTypes[0].ResourceTypeName -eq $type}

if ($location -eq $null)
{
return "West US"
} else
{
return $location.Locations[0]
}
}

return "West US"
}

Expand All @@ -71,6 +80,18 @@ function TestSetup-CreateResourceGroup
return $resourceGroup
}

<#
.SYNOPSIS
Creates a virtual network to use in tests
#>
function TestSetup-CreateVirtualNetwork($resourceGroup)
{
$virtualNetworkName = Get-VirtualNetworkName
$location = Get-ProviderLocation "microsoft.network/virtualNetworks"
$virtualNetwork = New-AzureRmVirtualNetwork -Name $virtualNetworkName -ResourceGroupName $resourceGroup.ResourceGroupName -Location $location -AddressPrefix "10.0.0.0/8"
return $virtualNetwork
}

function Get-RandomZoneName
{
$prefix = getAssetName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,44 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Azure.Commands.Common.Authentication;
using Microsoft.Azure.Gallery;
using Microsoft.Azure.Management.Authorization;
using Microsoft.Azure.Management.Dns;
using Microsoft.Azure.Management.Network;
using Microsoft.Azure.Management.Resources;
using Microsoft.Azure.Subscriptions;
using Microsoft.Azure.Test.HttpRecorder;
using RestTestFramework = Microsoft.Rest.ClientRuntime.Azure.TestFramework;
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using LegacyTest = Microsoft.Azure.Test;
using TestEnvironmentFactory = Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestEnvironmentFactory;
using TestUtilities = Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities;

namespace Microsoft.Azure.Commands.ScenarioTest.DnsTests
{
using Microsoft.Azure.Gallery;
using Microsoft.Azure.Management.Authorization;
using Microsoft.Azure.Management.Dns;
using Microsoft.Azure.Management.Resources;
using Microsoft.Azure.Subscriptions;
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using System;
using System.IO;
using System.Linq;
using WindowsAzure.Commands.Test.Utilities.Common;
using LegacyTest = Microsoft.Azure.Test;
using TestEnvironmentFactory = Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestEnvironmentFactory;
using TestUtilities = Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities;

public class DnsTestsBase : RMTestBase
{
private LegacyTest.CSMTestEnvironmentFactory csmTestFactory;


private readonly EnvironmentSetupHelper helper;


public ResourceManagementClient ResourceManagementClient { get; private set; }

public SubscriptionClient SubscriptionClient { get; private set; }


public GalleryClient GalleryClient { get; private set; }


public AuthorizationManagementClient AuthorizationManagementClient { get; private set; }


public DnsManagementClient DnsClient { get; private set; }

public NetworkManagementClient NetworkManagementClient { get; private set; }

public static DnsTestsBase NewInstance
{
Expand All @@ -71,21 +66,22 @@ protected DnsTestsBase()
}


protected void SetupManagementClients(MockContext context)
protected void SetupManagementClients(MockContext context)
{
this.ResourceManagementClient = this.GetResourceManagementClient();
this.SubscriptionClient = this.GetSubscriptionClient();
this.GalleryClient = this.GetGalleryClient();
this.AuthorizationManagementClient = this.GetAuthorizationManagementClient();
this.DnsClient = this.GetFeatureClient(context);

this.DnsClient = this.GetFeatureClient(context);
this.NetworkManagementClient = this.GetNetworkManagementClient(context);

this.helper.SetupManagementClients(
this.ResourceManagementClient,
this.SubscriptionClient,
this.GalleryClient,
this.AuthorizationManagementClient,
this.DnsClient);
this.DnsClient,
this.NetworkManagementClient);
}


Expand All @@ -97,9 +93,9 @@ public void RunPowerShellTest(params string[] scripts)

this.RunPsTestWorkflow(
() => scripts,
// no custom initializer
// no custom initializer
null,
// no custom cleanup
// no custom cleanup
null,
callingClassType,
mockName);
Expand Down Expand Up @@ -133,7 +129,7 @@ public void RunPsTestWorkflow(
}


this.SetupManagementClients(context);
this.SetupManagementClients(context);


this.helper.SetupEnvironment(AzureModule.AzureResourceManager);
Expand All @@ -148,6 +144,7 @@ public void RunPsTestWorkflow(
helper.RMProfileModule,
helper.RMResourceModule,
helper.GetRMModulePath("AzureRM.Dns.psd1"),
helper.GetRMModulePath("AzureRM.Network.psd1"),
"AzureRM.Resources.ps1");

try
Expand Down Expand Up @@ -178,6 +175,11 @@ protected ResourceManagementClient GetResourceManagementClient()
return LegacyTest.TestBase.GetServiceClient<ResourceManagementClient>(this.csmTestFactory);
}

protected NetworkManagementClient GetNetworkManagementClient(MockContext context)
{
return context.GetServiceClient<NetworkManagementClient>(TestEnvironmentFactory.GetTestEnvironment());
}

private AuthorizationManagementClient GetAuthorizationManagementClient()
{
return LegacyTest.TestBase.GetServiceClient<AuthorizationManagementClient>(this.csmTestFactory);
Expand All @@ -193,9 +195,9 @@ private GalleryClient GetGalleryClient()
return LegacyTest.TestBase.GetServiceClient<GalleryClient>(this.csmTestFactory);
}

private DnsManagementClient GetFeatureClient(MockContext context)
private DnsManagementClient GetFeatureClient(MockContext context)
{
return context.GetServiceClient<DnsManagementClient>(TestEnvironmentFactory.GetTestEnvironment());
return context.GetServiceClient<DnsManagementClient>(TestEnvironmentFactory.GetTestEnvironment());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,41 @@ public void TestZoneCrud()
DnsTestsBase.NewInstance.RunPowerShellTest("Test-ZoneCrud");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestPrivateZoneCrud()
{
DnsTestsBase.NewInstance.RunPowerShellTest("Test-PrivateZoneCrud");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestPrivateZoneCrudRegistrationVirtualNetwork()
{
DnsTestsBase.NewInstance.RunPowerShellTest("Test-PrivateZoneCrudRegistrationVnet");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestPrivateZoneCrudResolutionVirtualNetwork()
{
DnsTestsBase.NewInstance.RunPowerShellTest("Test-PrivateZoneCrudResolutionVnet");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestPrivateZoneCrudByVirtualNetworkIds()
{
DnsTestsBase.NewInstance.RunPowerShellTest("Test-PrivateZoneCrudByVirtualNetworkIds");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestPrivateZoneCrudByVirtualNetworkObjects()
{
DnsTestsBase.NewInstance.RunPowerShellTest("Test-PrivateZoneCrudByVirtualNetworkObjects");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestZoneCrudTrimsDot()
Expand Down
Loading