Skip to content

Commit d5c8d0e

Browse files
author
Maddie Clayton
authored
Merge pull request Azure#8623 from pranavpnair/links1
Add support for Private DNS VirtualNetwork links
2 parents 29136b8 + 9a4299c commit d5c8d0e

File tree

45 files changed

+41334
-47
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+41334
-47
lines changed

src/PrivateDns/PrivateDns.Test/ScenarioTests/Common.ps1

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ function Get-RandomZoneName
6969
return $prefix + ".pstest.test" ;
7070
}
7171

72+
function Get-RandomLinkName
73+
{
74+
$prefix = getAssetName;
75+
return $prefix + ".testlink" ;
76+
}
77+
7278
function Get-TxtOfSpecifiedLength([int] $length)
7379
{
7480
$returnValue = "";
@@ -77,4 +83,23 @@ function Get-TxtOfSpecifiedLength([int] $length)
7783
$returnValue += "a";
7884
}
7985
return $returnValue;
86+
}
87+
88+
function Create-VirtualNetworkLink([bool] $registrationEnabled)
89+
{
90+
$zoneName = Get-RandomZoneName
91+
$linkName = Get-RandomLinkName
92+
$resourceGroup = TestSetup-CreateResourceGroup
93+
94+
$createdZone = New-AzPrivateDnsZone -Name $zoneName -ResourceGroupName $resourceGroup.ResourceGroupName -Tag @{tag1="value1"}
95+
$createdVirtualNetwork = TestSetup-CreateVirtualNetwork $resourceGroup
96+
if($registrationEnabled)
97+
{
98+
$createdLink = New-AzPrivateDnsVirtualNetworkLink -ZoneName $zoneName -ResourceGroupName $resourceGroup.ResourceGroupName -Name $linkName -Tag @{tag1="value1"} -VirtualNetworkId $createdVirtualNetwork.Id -EnableRegistration
99+
}
100+
else
101+
{
102+
$createdLink = New-AzPrivateDnsVirtualNetworkLink -ZoneName $zoneName -ResourceGroupName $resourceGroup.ResourceGroupName -Name $linkName -Tag @{tag1="value1"} -VirtualNetworkId $createdVirtualNetwork.Id
103+
}
104+
return $createdLink
80105
}
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
// Licensed under the Apache License, Version 2.0 (the "License");
2+
// you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at
4+
// http://www.apache.org/licenses/LICENSE-2.0
5+
// Unless required by applicable law or agreed to in writing, software
6+
// distributed under the License is distributed on an "AS IS" BASIS,
7+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8+
// See the License for the specific language governing permissions and
9+
// limitations under the License.
10+
// ----------------------------------------------------------------------------------
11+
12+
13+
namespace Microsoft.Azure.Commands.PrivateDns.Test.ScenarioTests
14+
{
15+
using Microsoft.Azure.ServiceManagement.Common.Models;
16+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
17+
using Xunit;
18+
19+
public class LinkTests : PrivateDnsTestsBase
20+
{
21+
public XunitTracingInterceptor Logger;
22+
23+
public LinkTests(Xunit.Abstractions.ITestOutputHelper output)
24+
{
25+
Logger = new XunitTracingInterceptor(output);
26+
XunitTracingInterceptor.AddToContext(Logger);
27+
}
28+
29+
[Fact]
30+
[Trait(Category.AcceptanceType, Category.CheckIn)]
31+
public void TestLinkCrud()
32+
{
33+
PrivateDnsTestsBase.NewInstance.RunPowerShellTest(Logger, "Test-LinkCrud");
34+
}
35+
36+
[Fact]
37+
[Trait(Category.AcceptanceType, Category.CheckIn)]
38+
public void TestLinkCrudWithPiping()
39+
{
40+
PrivateDnsTestsBase.NewInstance.RunPowerShellTest(Logger, "Test-LinkCrudWithPiping");
41+
}
42+
43+
[Fact]
44+
[Trait(Category.AcceptanceType, Category.CheckIn)]
45+
public void TestRegistrationLinkCreate()
46+
{
47+
PrivateDnsTestsBase.NewInstance.RunPowerShellTest(Logger, "Test-RegistrationLinkCreate");
48+
}
49+
50+
[Fact]
51+
[Trait(Category.AcceptanceType, Category.CheckIn)]
52+
public void TestLinkAlreadyExistsCreateThrow()
53+
{
54+
PrivateDnsTestsBase.NewInstance.RunPowerShellTest(Logger, "Test-LinkAlreadyExistsCreateThrow");
55+
}
56+
57+
[Fact]
58+
[Trait(Category.AcceptanceType, Category.CheckIn)]
59+
public void TestUpdateLinkRegistrationStatusWithPiping()
60+
{
61+
PrivateDnsTestsBase.NewInstance.RunPowerShellTest(Logger, "Test-UpdateLinkRegistrationStatusWithPiping");
62+
}
63+
64+
[Fact]
65+
[Trait(Category.AcceptanceType, Category.CheckIn)]
66+
public void TestUpdateLinkRegistrationStatusWithPipingResourceId()
67+
{
68+
PrivateDnsTestsBase.NewInstance.RunPowerShellTest(Logger, "Test-UpdateLinkRegistrationStatusWithResourceId");
69+
}
70+
71+
[Fact]
72+
[Trait(Category.AcceptanceType, Category.CheckIn)]
73+
public void TestUpdateLinkWithEtagMismatchThrow()
74+
{
75+
PrivateDnsTestsBase.NewInstance.RunPowerShellTest(Logger, "Test-UpdateLinkWithEtagMismatchThrow");
76+
}
77+
78+
[Fact]
79+
[Trait(Category.AcceptanceType, Category.CheckIn)]
80+
public void TestDeleteLinkWithResourceId()
81+
{
82+
PrivateDnsTestsBase.NewInstance.RunPowerShellTest(Logger, "Test-DeleteLinkWithResourceId");
83+
}
84+
85+
[Fact]
86+
[Trait(Category.AcceptanceType, Category.CheckIn)]
87+
public void TestUpdateLinkWithEtagMismatchOverwrite()
88+
{
89+
PrivateDnsTestsBase.NewInstance.RunPowerShellTest(Logger, "Test-UpdateLinkWithEtagMismatchOverwrite");
90+
}
91+
92+
[Fact]
93+
[Trait(Category.AcceptanceType, Category.CheckIn)]
94+
public void TestUpdateLinkZoneNotExistsThrow()
95+
{
96+
PrivateDnsTestsBase.NewInstance.RunPowerShellTest(Logger, "Test-UpdateLinkZoneNotExistsThrow");
97+
}
98+
99+
[Fact]
100+
[Trait(Category.AcceptanceType, Category.CheckIn)]
101+
public void TestUpdateLinkLinkNotExistsThrow()
102+
{
103+
PrivateDnsTestsBase.NewInstance.RunPowerShellTest(Logger, "Test-UpdateLinkLinkNotExistsThrow");
104+
}
105+
106+
[Fact]
107+
[Trait(Category.AcceptanceType, Category.CheckIn)]
108+
public void TestUpdateLinkWithNoChangesShouldNotThrow()
109+
{
110+
PrivateDnsTestsBase.NewInstance.RunPowerShellTest(Logger, "Test-UpdateLinkWithNoChangesShouldNotThrow");
111+
}
112+
113+
[Fact]
114+
[Trait(Category.AcceptanceType, Category.CheckIn)]
115+
public void TestGetLinkZoneNotExistsThrow()
116+
{
117+
PrivateDnsTestsBase.NewInstance.RunPowerShellTest(Logger, "Test-GetLinkZoneNotExistsThrow");
118+
}
119+
120+
[Fact]
121+
[Trait(Category.AcceptanceType, Category.CheckIn)]
122+
public void TestGetLinkLinkNotExistsThrow()
123+
{
124+
PrivateDnsTestsBase.NewInstance.RunPowerShellTest(Logger, "Test-GetLinkLinkNotExistsThrow");
125+
}
126+
127+
[Fact]
128+
[Trait(Category.AcceptanceType, Category.CheckIn)]
129+
public void TestRemoveLinkZoneNotExistsShouldNotThrow()
130+
{
131+
PrivateDnsTestsBase.NewInstance.RunPowerShellTest(Logger, "Test-RemoveLinkZoneNotExistsShouldNotThrow");
132+
}
133+
134+
[Fact]
135+
[Trait(Category.AcceptanceType, Category.CheckIn)]
136+
public void TestRemoveLinkLinkNotExistsShouldNotThrow()
137+
{
138+
PrivateDnsTestsBase.NewInstance.RunPowerShellTest(Logger, "Test-RemoveLinkLinkNotExistsShouldNotThrow");
139+
}
140+
141+
[Fact]
142+
[Trait(Category.AcceptanceType, Category.CheckIn)]
143+
public void TestListLinks()
144+
{
145+
PrivateDnsTestsBase.NewInstance.RunPowerShellTest(Logger, "Test-ListLinks");
146+
}
147+
}
148+
}

0 commit comments

Comments
 (0)