Skip to content

Commit 99556dd

Browse files
author
Vlad Cananau
committed
Use version 1.0.0 of the TrafficManager .NET SDK, add support for MinChildEndpoints and expose resource ID for profiles
1 parent c6c9279 commit 99556dd

File tree

38 files changed

+2597
-4049
lines changed

38 files changed

+2597
-4049
lines changed

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/Commands.TrafficManager.Test.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
</ItemGroup>
118118
<ItemGroup>
119119
<Compile Include="Properties\AssemblyInfo.cs" />
120+
<Compile Include="ScenarioTests\NestedEndpointsTests.cs" />
120121
<Compile Include="ScenarioTests\ProfileTests.cs" />
121122
<Compile Include="ScenarioTests\EndpointTests.cs" />
122123
<Compile Include="ScenarioTests\TestController.cs" />
@@ -132,6 +133,9 @@
132133
<None Include="ScenarioTests\EndpointTests.ps1">
133134
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
134135
</None>
136+
<None Include="ScenarioTests\NestedEndpointsTests.ps1">
137+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
138+
</None>
135139
<None Include="ScenarioTests\ProfileTests.ps1">
136140
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
137141
</None>

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/ScenarioTests/EndpointTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,28 +82,28 @@ public void TestRemoveNonExistingEndpointFromProfile()
8282
TestController.NewInstance.RunPowerShellTest("Test-RemoveNonExistingEndpointFromProfile");
8383
}
8484

85-
[Fact(Skip = "Bug")]
85+
[Fact(Skip = "TFS#5185296")]
8686
[Trait(Category.AcceptanceType, Category.CheckIn)]
8787
public void TestEnableEndpoint()
8888
{
8989
TestController.NewInstance.RunPowerShellTest("Test-EnableEndpoint");
9090
}
9191

92-
[Fact(Skip = "Bug")]
92+
[Fact(Skip = "TFS#5185296")]
9393
[Trait(Category.AcceptanceType, Category.CheckIn)]
9494
public void TestDisableEndpoint()
9595
{
9696
TestController.NewInstance.RunPowerShellTest("Test-DisableEndpoint");
9797
}
9898

99-
[Fact(Skip = "Bug")]
99+
[Fact(Skip = "TFS#5185296")]
100100
[Trait(Category.AcceptanceType, Category.CheckIn)]
101101
public void TestEnableEndpointUsingPiping()
102102
{
103103
TestController.NewInstance.RunPowerShellTest("Test-EnableEndpointUsingPiping");
104104
}
105105

106-
[Fact(Skip = "Bug")]
106+
[Fact(Skip = "TFS#5185296")]
107107
[Trait(Category.AcceptanceType, Category.CheckIn)]
108108
public void TestDisableEndpointUsingPiping()
109109
{

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/ScenarioTests/EndpointTests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,9 @@ function Test-EnableEndpointUsingPiping
283283

284284
<#
285285
.SYNOPSIS
286-
Disable Endpoint
286+
Disable Endpoint using piping
287287
#>
288-
function Test-DisableEndpoint
288+
function Test-DisableEndpointUsingPiping
289289
{
290290
$endpointName = getAssetname
291291
$profileName = getAssetname
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
namespace Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests
16+
{
17+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
18+
using Xunit;
19+
20+
public class NestedEndpointsTests
21+
{
22+
[Fact]
23+
[Trait(Category.AcceptanceType, Category.CheckIn)]
24+
public void TestNestedEndpointsCreateUpdate()
25+
{
26+
TestController.NewInstance.RunPowerShellTest("Test-NestedEndpointsCreateUpdate");
27+
}
28+
}
29+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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+
<#
16+
.SYNOPSIS
17+
Profile with Nested Endpoint
18+
#>
19+
function Test-NestedEndpointsCreateUpdate
20+
{
21+
$resourceGroup = TestSetup-CreateResourceGroup
22+
$childProfileName = getAssetName
23+
$childProfileRelativeName = getAssetName
24+
$anotherChildProfileName = getAssetName
25+
$anotherChildProfileRelativeName = getAssetName
26+
$parentProfileName = getAssetName
27+
$parentProfileRelativeName = getAssetName
28+
29+
$createdChildProfile = New-AzureRmTrafficManagerProfile -Name $childProfileName -ResourceGroupName $resourceGroup.ResourceGroupName -RelativeDnsName $childProfileRelativeName -Ttl 50 -TrafficRoutingMethod "Performance" -MonitorProtocol "HTTP" -MonitorPort 80 -MonitorPath "/testpath.asp"
30+
Assert-NotNull $createdChildProfile.Id
31+
32+
$createdParentProfile = New-AzureRmTrafficManagerProfile -Name $parentProfileName -ResourceGroupName $resourceGroup.ResourceGroupName -RelativeDnsName $parentProfileRelativeName -Ttl 50 -TrafficRoutingMethod "Performance" -MonitorProtocol "HTTP" -MonitorPort 80 -MonitorPath "/testpath.asp"
33+
$createdParentProfile = Add-AzureRmTrafficManagerEndpointConfig -EndpointName "MyNestedEndpoint" -TrafficManagerProfile $createdParentProfile -Type "NestedEndpoints" -TargetResourceId $createdChildProfile.Id -EndpointStatus "Enabled" -EndpointLocation "North Europe" -MinChildEndpoints 2
34+
$updatedParentProfile = Set-AzureRmTrafficManagerProfile -TrafficManagerProfile $createdParentProfile
35+
36+
Assert-NotNull $updatedParentProfile
37+
Assert-AreEqual 1 $updatedParentProfile.Endpoints.Count
38+
Assert-AreEqual 2 $updatedParentProfile.Endpoints[0].MinChildEndpoints
39+
Assert-AreEqual "North Europe" $updatedParentProfile.Endpoints[0].Location
40+
41+
$retrievedParentProfile = Get-AzureRmTrafficManagerProfile -Name $parentProfileName -ResourceGroupName $resourceGroup.ResourceGroupName
42+
43+
Assert-NotNull $retrievedParentProfile
44+
Assert-AreEqual 1 $retrievedParentProfile.Endpoints.Count
45+
Assert-AreEqual 2 $retrievedParentProfile.Endpoints[0].MinChildEndpoints
46+
Assert-AreEqual "North Europe" $retrievedParentProfile.Endpoints[0].Location
47+
48+
$anotherCreatedChildProfile = New-AzureRmTrafficManagerProfile -Name $anotherChildProfileName -ResourceGroupName $resourceGroup.ResourceGroupName -RelativeDnsName $anotherChildProfileRelativeName -Ttl 50 -TrafficRoutingMethod "Performance" -MonitorProtocol "HTTP" -MonitorPort 80 -MonitorPath "/testpath.asp"
49+
Assert-NotNull $anotherCreatedChildProfile.Id
50+
51+
$anotherNestedEndpoint = New-AzureRmTrafficManagerEndpoint -Name "MySecondNestedEndpoint" -ProfileName $parentProfileName -ResourceGroupName $resourceGroup.ResourceGroupName -Type "NestedEndpoints" -TargetResourceId $anotherCreatedChildProfile.Id -EndpointStatus "Enabled" -EndpointLocation "West Europe" -MinChildEndpoints 3
52+
53+
Assert-NotNull $anotherNestedEndpoint
54+
Assert-AreEqual 3 $anotherNestedEndpoint.MinChildEndpoints
55+
Assert-AreEqual "West Europe" $anotherNestedEndpoint.Location
56+
57+
$retrievedParentProfile = Get-AzureRmTrafficManagerProfile -Name $parentProfileName -ResourceGroupName $resourceGroup.ResourceGroupName
58+
59+
Assert-NotNull $retrievedParentProfile
60+
Assert-AreEqual 2 $retrievedParentProfile.Endpoints.Count
61+
Assert-AreEqual 3 $retrievedParentProfile.Endpoints[1].MinChildEndpoints
62+
Assert-AreEqual "West Europe" $retrievedParentProfile.Endpoints[1].Location
63+
64+
$anotherNestedEndpoint.MinChildEndpoints = 4
65+
$anotherNestedEndpoint.Location = "West US"
66+
67+
$anotherNestedEndpoint = Set-AzureRmTrafficManagerEndpoint -TrafficManagerEndpoint $anotherNestedEndpoint
68+
69+
Assert-NotNull $anotherNestedEndpoint
70+
Assert-AreEqual 4 $anotherNestedEndpoint.MinChildEndpoints
71+
Assert-AreEqual "West US" $anotherNestedEndpoint.Location
72+
73+
$retrievedParentProfile = Get-AzureRmTrafficManagerProfile -Name $parentProfileName -ResourceGroupName $resourceGroup.ResourceGroupName
74+
75+
Assert-NotNull $retrievedParentProfile
76+
Assert-AreEqual 2 $retrievedParentProfile.Endpoints.Count
77+
Assert-AreEqual 4 $retrievedParentProfile.Endpoints[1].MinChildEndpoints
78+
Assert-AreEqual "West US" $retrievedParentProfile.Endpoints[1].Location
79+
}

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/SessionRecords/Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.EndpointTests/TestAddEndpoint.json

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

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/SessionRecords/Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.EndpointTests/TestCreateExistingEndpoint.json

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

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/SessionRecords/Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.EndpointTests/TestCreateExistingEndpointFromNonExistingProfile.json

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

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/SessionRecords/Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.EndpointTests/TestDeleteEndpoint.json

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

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/SessionRecords/Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.EndpointTests/TestDisableNonExistingEndpoint.json

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

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/SessionRecords/Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.EndpointTests/TestEnableNonExistingEndpoint.json

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

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/SessionRecords/Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.EndpointTests/TestEndpointCrud.json

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

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/SessionRecords/Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.EndpointTests/TestEndpointCrudPiping.json

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

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/SessionRecords/Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.EndpointTests/TestGetExistingEndpointFromNonExistingProfile.json

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

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/SessionRecords/Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.EndpointTests/TestRemoveExistingEndpointFromNonExistingProfile.json

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

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/SessionRecords/Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.EndpointTests/TestRemoveNonExistingEndpointFromProfile.json

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

0 commit comments

Comments
 (0)