Skip to content

Commit c4904fe

Browse files
authored
Merge pull request #4 from Azure/master
Sync
2 parents a9f8057 + 5127415 commit c4904fe

File tree

147 files changed

+40883
-778
lines changed

Some content is hidden

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

147 files changed

+40883
-778
lines changed

src/Network/Network.Test/Network.Test.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<PackageReference Include="Microsoft.Azure.Management.Redis" Version="4.4.1" />
2222
<PackageReference Include="Microsoft.Azure.Management.OperationalInsights" Version="0.19.0-preview" />
2323
<PackageReference Include="Microsoft.Azure.Management.ManagedServiceIdentity" Version="0.10.0-preview" />
24+
<PackageReference Include="Microsoft.Azure.Management.Sql" Version="1.36.0-preview" />
2425
</ItemGroup>
2526

2627
<ItemGroup>

src/Network/Network.Test/ScenarioTests/ApplicationGatewayTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,21 @@ public void TestApplicationGatewayCRUDRewriteRuleSetWithConditions()
105105
{
106106
TestRunner.RunTestScript(string.Format("Test-ApplicationGatewayCRUDRewriteRuleSetWithConditions -baseDir '{0}'", AppDomain.CurrentDomain.BaseDirectory));
107107
}
108+
109+
[Fact]
110+
[Trait(Category.AcceptanceType, Category.CheckIn)]
111+
[Trait(Category.Owner, NrpTeamAlias.nvadev)]
112+
public void TestTopLevelWafResourceWithApplicationGateway()
113+
{
114+
TestRunner.RunTestScript(string.Format("Test-ApplicationGatewayTopLevelFirewallPolicy -baseDir '{0}'", AppDomain.CurrentDomain.BaseDirectory));
115+
}
116+
117+
[Fact]
118+
[Trait(Category.AcceptanceType, Category.CheckIn)]
119+
[Trait(Category.Owner, NrpTeamAlias.nvadev)]
120+
public void TestApplicationGatewayWithFirewallPolicy()
121+
{
122+
TestRunner.RunTestScript(string.Format("Test-ApplicationGatewayWithFirewallPolicy -baseDir '{0}'", AppDomain.CurrentDomain.BaseDirectory));
123+
}
108124
}
109125
}

src/Network/Network.Test/ScenarioTests/ApplicationGatewayTests.ps1

Lines changed: 473 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Commands.Network.Test.ScenarioTests;
16+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
17+
using Xunit;
18+
19+
namespace Commands.Network.Test.ScenarioTests
20+
{
21+
public class IpGroupTests : NetworkTestRunner
22+
{
23+
public IpGroupTests(Xunit.Abstractions.ITestOutputHelper output)
24+
: base(output)
25+
{
26+
}
27+
28+
[Fact]
29+
[Trait(Category.AcceptanceType, Category.CheckIn)]
30+
[Trait(Category.Owner, NrpTeamAlias.azurefirewall)]
31+
public void TestIpGroupBasicOperations()
32+
{
33+
TestRunner.RunTestScript(string.Format("Test-IpGroupsCRUD"));
34+
}
35+
}
36+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#----------------------------------------------------------------------------------
2+
3+
#
4+
# Copyright Microsoft Corporation
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ----------------------------------------------------------------------------------
15+
16+
function Check-CmdletReturnType
17+
{
18+
param($cmdletName, $cmdletReturn)
19+
20+
$cmdletData = Get-Command $cmdletName
21+
Assert-NotNull $cmdletData
22+
[array]$cmdletReturnTypes = $cmdletData.OutputType.Name | Foreach-Object { return ($_ -replace "Microsoft.Azure.Commands.Network.Models.","") }
23+
[array]$cmdletReturnTypes = $cmdletReturnTypes | Foreach-Object { return ($_ -replace "System.","") }
24+
$realReturnType = $cmdletReturn.GetType().Name -replace "Microsoft.Azure.Commands.Network.Models.",""
25+
return $cmdletReturnTypes -contains $realReturnType
26+
}
27+
28+
<#
29+
.SYNOPSIS
30+
Test creating new IpGroups
31+
#>
32+
function Test-IpGroupsCRUD
33+
{
34+
# Setup
35+
$rgname = Get-ResourceGroupName
36+
$rglocation = Get-ProviderLocation ResourceManagement "westus"
37+
$location = Get-ProviderLocation ResourceManagement "westus"
38+
$IpGroupsName = Get-ResourceName
39+
40+
try
41+
{
42+
# Create the resource group
43+
New-AzResourceGroup -Name $rgname -Location $rglocation -Tags @{ testtag = "testval" }
44+
45+
# Create IpGroup
46+
$actualIpGroup = New-AzIpGroup -ResourceGroupName $rgname -location $location -Name $IpGroupsName -IpAddress 10.0.0.0/24,11.9.0.0/24
47+
$expectedIpGroup = Get-AzIpGroup -ResourceGroupName $rgname -Name $IpGroupsName
48+
Assert-AreEqual $expectedIpGroup.ResourceGroupName $actualIpGroup.ResourceGroupName
49+
Assert-AreEqual $expectedIpGroup.Name $actualIpGroup.Name
50+
51+
# Delete IpGroup
52+
$deleteIpGroup = Remove-AzIpGroup -ResourceGroupName $rgname -Name $IpGroupsName -PassThru -Force
53+
Assert-AreEqual true $deleteIpGroup
54+
55+
}
56+
finally
57+
{
58+
# Cleanup
59+
Clean-ResourceGroup $rgname
60+
}
61+
}

src/Network/Network.Test/ScenarioTests/PrivateLinkServiceTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,13 @@ public void TestPrivateLinkServiceCRUD()
3232
{
3333
TestRunner.RunTestScript("Test-PrivateLinkServiceCRUD");
3434
}
35+
36+
[Fact]
37+
[Trait(Category.AcceptanceType, Category.CheckIn)]
38+
[Trait(Category.Owner, NrpTeamAlias.sdnnrp)]
39+
public void TestPrivateEndpointConnectionCRUD()
40+
{
41+
TestRunner.RunTestScript("Test-PrivateEndpointConnectionCRUD");
42+
}
3543
}
3644
}

src/Network/Network.Test/ScenarioTests/PrivateLinkServiceTests.ps1

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,88 @@ function Test-PrivateLinkServiceCRUD
118118
}
119119
}
120120

121+
<#
122+
.SYNOPSIS
123+
Test operation for PrivateEndpointConnection.
124+
#>
125+
function Test-PrivateEndpointConnectionCRUD
126+
{
127+
# Setup
128+
$rgname = Get-ResourceGroupName;
129+
$rname = Get-ResourceName;
130+
$location = Get-ProviderLocation "Microsoft.Network/privateLinkServices" "westus2";
131+
# Dependency parameters
132+
$IpConfigurationName = "IpConfigurationName";
133+
$vnetName = Get-ResourceName;
134+
$ilbFrontName = "LB-Frontend";
135+
$ilbBackendName = "LB-Backend";
136+
$ilbName = Get-ResourceName;
137+
138+
$serverName = Get-ResourceName
139+
$serverLogin = "testusername"
140+
<#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Test passwords only valid for the duration of the test")]#>
141+
$serverPassword = "t357ingP@s5w0rd!Sec"
142+
$credentials = new-object System.Management.Automation.PSCredential($serverLogin, ($serverPassword | ConvertTo-SecureString -asPlainText -Force))
143+
$databaseName = "mySampleDatabase"
144+
$peName = "mype"
145+
$subId = getSubscription
146+
147+
try
148+
{
149+
$resourceGroup = New-AzResourceGroup -Name $rgname -Location $location;
150+
151+
if ((Get-NetworkTestMode) -ne 'Playback')
152+
{
153+
# Create Sql Storage Account
154+
$server = New-AzSqlServer -ResourceGroupName $rgname `
155+
-ServerName $serverName `
156+
-Location $location `
157+
-SqlAdministratorCredentials $credentials
158+
159+
$database = New-AzSqlDatabase -ResourceGroupName $rgname `
160+
-ServerName $serverName `
161+
-DatabaseName $databaseName `
162+
-RequestedServiceObjectiveName "Basic" `
163+
-Edition "Basic"
164+
165+
$sqlResourceId = $server.ResourceId
166+
}
167+
else
168+
{
169+
$sqlResourceId = "/subscriptions/$subId/resourceGroups/$rgname/providers/Microsoft.Sql/servers/$serverName"
170+
}
171+
172+
# Create Private Endpoint
173+
$peSubnet = New-AzVirtualNetworkSubnetConfig -Name peSubnet -AddressPrefix "11.0.1.0/24" -PrivateEndpointNetworkPolicies "Disabled"
174+
$vnetPE = New-AzVirtualNetwork -Name "vnetPE" -ResourceGroupName $rgname -Location $location -AddressPrefix "11.0.0.0/16" -Subnet $peSubnet
175+
176+
$plsConnection= New-AzPrivateLinkServiceConnection -Name plsConnection -PrivateLinkServiceId $sqlResourceId -GroupId 'sqlServer'
177+
$privateEndpoint = New-AzPrivateEndpoint -ResourceGroupName $rgname -Name $peName -Location $location -Subnet $vnetPE.subnets[0] -PrivateLinkServiceConnection $plsConnection -ByManualRequest
178+
179+
# Get Private Endpoint Connection
180+
$pecGet = Get-AzPrivateEndpointConnection -PrivateLinkResourceId $sqlResourceId
181+
Assert-NotNull $pecGet;
182+
Assert-AreEqual "Pending" $pecGet.PrivateLinkServiceConnectionState.Status
183+
184+
# Approve Private Endpoint Connection
185+
$pecApprove = Approve-AzPrivateEndpointConnection -ResourceId $pecGet.Id
186+
Assert-NotNull $pecApprove;
187+
Assert-AreEqual "Approved" $pecApprove.PrivateLinkServiceConnectionState.Status
188+
189+
Start-TestSleep 30000
190+
191+
# Remove Private Endpoint Connection
192+
$pecRemove = Remove-AzPrivateEndpointConnection -ResourceId $pecGet.Id -PassThru -Force
193+
Assert-AreEqual true $pecRemove
194+
195+
# Get Private Endpoint Connection again
196+
$pecGet2 = Get-AzPrivateEndpointConnection -PrivateLinkResourceId $sqlResourceId
197+
Assert-Null($pecGet2)
198+
199+
}
200+
finally
201+
{
202+
# Cleanup
203+
Clean-ResourceGroup $rgname;
204+
}
205+
}

0 commit comments

Comments
 (0)