Skip to content

Commit bc8dace

Browse files
author
Maddie Clayton
authored
Merge pull request #6841 from allencal/preview
Changes for TrafficManager 2018-04-01 API
2 parents d43b20b + f82f3cd commit bc8dace

File tree

101 files changed

+17119
-7688
lines changed

Some content is hidden

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

101 files changed

+17119
-7688
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function TestSetup-CreateProfile($profileName, $resourceGroupName, $routingMetho
7979
{
8080
$relativeName = getAssetName
8181

82-
$profile = New-AzureRmTrafficManagerProfile -Name $profileName -ResourceGroupName $resourceGroupName -RelativeDnsName $relativeName -Ttl 50 -TrafficRoutingMethod $routingMethod -MonitorProtocol "HTTP" -MonitorPort 80 -MonitorPath "/testpath.asp"
82+
$profile = New-AzureRmTrafficManagerProfile -Name $profileName -ResourceGroupName $resourceGroupName -RelativeDnsName $relativeName -Ttl 50 -TrafficRoutingMethod $routingMethod -MonitorProtocol "HTTP" -MonitorPort 80 -MonitorPath "/testpath.asp" -ProfileStatus "Enabled"
8383

8484
return $profile
8585
}

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,19 @@ public void TestPipeEndpointFromGetProfile()
167167
{
168168
TestController.NewInstance.RunPowerShellTest(_logger, "Test-PipeEndpointFromGetProfile");
169169
}
170+
171+
[Fact]
172+
[Trait(Category.AcceptanceType, Category.CheckIn)]
173+
public void TestAddAndRemoveCustomHeadersFromEndpoint()
174+
{
175+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-AddAndRemoveCustomHeadersFromEndpoint");
176+
}
177+
178+
[Fact]
179+
[Trait(Category.AcceptanceType, Category.CheckIn)]
180+
public void TestAddAndRemoveIpAddressRanges()
181+
{
182+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-AddAndRemoveIpAddressRanges");
183+
}
170184
}
171185
}

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

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,4 +654,100 @@ function Test-PipeEndpointFromGetProfile
654654
# Cleanup
655655
TestCleanup-RemoveResourceGroup $resourceGroup.ResourceGroupName
656656
}
657+
}
658+
659+
<#
660+
.SYNOPSIS
661+
Add and remove custom headers
662+
#>
663+
function Test-AddAndRemoveCustomHeadersFromEndpoint
664+
{
665+
$endpointName = getAssetname
666+
$profileName = getAssetname
667+
$resourceGroup = TestSetup-CreateResourceGroup
668+
669+
try
670+
{
671+
$profile = TestSetup-CreateProfile $profileName $resourceGroup.ResourceGroupName "Weighted"
672+
673+
$endpoint = New-AzureRmTrafficManagerEndpoint -Name $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Type "ExternalEndpoints" -Target "www.contoso.com" -EndpointStatus "Disabled" -EndpointLocation "West US"
674+
675+
$retrievedProfile = Get-AzureRmTrafficManagerProfile -Name $profileName -ResourceGroupName $resourceGroup.ResourceGroupName
676+
677+
$retrievedEndpoint = $retrievedProfile.Endpoints[0]
678+
679+
Assert-True { Add-AzureRmTrafficManagerCustomHeaderToEndpoint -Name "foo" -Value "bar" -TrafficManagerEndpoint $retrievedEndpoint }
680+
681+
Set-AzureRmTrafficManagerEndpoint -TrafficManagerEndpoint $retrievedEndpoint
682+
683+
$endpoint = Get-AzureRmTrafficManagerEndpoint -Name $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Type "ExternalEndpoints"
684+
685+
Assert-AreEqual "foo" $endpoint.CustomHeaders[0].Name
686+
Assert-AreEqual "bar" $endpoint.CustomHeaders[0].Value
687+
Assert-AreEqual 1 $endpoint.CustomHeaders.Count
688+
689+
Assert-True { Remove-AzureRmTrafficManagerCustomHeaderFromEndpoint -Name "foo" -TrafficManagerEndpoint $endpoint }
690+
691+
Set-AzureRmTrafficManagerEndpoint -TrafficManagerEndpoint $endpoint
692+
693+
$endpoint = Get-AzureRmTrafficManagerEndpoint -Name $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Type "ExternalEndpoints"
694+
695+
Assert-AreEqual 0 $endpoint.CustomHeaders.Count
696+
697+
}
698+
finally
699+
{
700+
# Cleanup
701+
TestCleanup-RemoveResourceGroup $resourceGroup.ResourceGroupName
702+
}
703+
}
704+
705+
<#
706+
.SYNOPSIS
707+
Add and remove IP address ranges
708+
#>
709+
function Test-AddAndRemoveIpAddressRanges
710+
{
711+
$endpointName = getAssetname
712+
$profileName = getAssetname
713+
$resourceGroup = TestSetup-CreateResourceGroup
714+
715+
try
716+
{
717+
$profile = TestSetup-CreateProfile $profileName $resourceGroup.ResourceGroupName "Weighted"
718+
719+
$endpoint = New-AzureRmTrafficManagerEndpoint -Name $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Type "ExternalEndpoints" -Target "www.contoso.com" -EndpointStatus "Disabled" -EndpointLocation "West US"
720+
721+
$retrievedProfile = Get-AzureRmTrafficManagerProfile -Name $profileName -ResourceGroupName $resourceGroup.ResourceGroupName
722+
723+
$retrievedEndpoint = $retrievedProfile.Endpoints[0]
724+
725+
Assert-True { Add-AzureRmTrafficManagerIpAddressRange -TrafficManagerEndpoint $retrievedEndpoint -First "2.3.4.0" -Scope 24 }
726+
Assert-True { Add-AzureRmTrafficManagerIpAddressRange -TrafficManagerEndpoint $retrievedEndpoint -First "5.6.0.0" -Last "5.6.255.255" }
727+
728+
Set-AzureRmTrafficManagerEndpoint -TrafficManagerEndpoint $retrievedEndpoint
729+
730+
$endpoint = Get-AzureRmTrafficManagerEndpoint -Name $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Type "ExternalEndpoints"
731+
732+
Assert-AreEqual 2 $endpoint.SubnetMapping.Count
733+
Assert-AreEqual "2.3.4.0" $endpoint.SubnetMapping[0].First
734+
Assert-AreEqual 24 $endpoint.SubnetMapping[0].Scope
735+
Assert-AreEqual "5.6.0.0" $endpoint.SubnetMapping[1].First
736+
Assert-AreEqual "5.6.255.255" $endpoint.SubnetMapping[1].Last
737+
738+
Assert-True { Remove-AzureRmTrafficManagerIpAddressRange -First 2.3.4.0 -TrafficManagerEndpoint $endpoint }
739+
740+
Set-AzureRmTrafficManagerEndpoint -TrafficManagerEndpoint $endpoint
741+
742+
$endpoint = Get-AzureRmTrafficManagerEndpoint -Name $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Type "ExternalEndpoints"
743+
744+
Assert-AreEqual 1 $endpoint.SubnetMapping.Count
745+
Assert-AreEqual "5.6.0.0" $endpoint.SubnetMapping[0].First
746+
Assert-AreEqual "5.6.255.255" $endpoint.SubnetMapping[0].Last
747+
}
748+
finally
749+
{
750+
# Cleanup
751+
TestCleanup-RemoveResourceGroup $resourceGroup.ResourceGroupName
752+
}
657753
}

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ function Test-NestedEndpointsCreateUpdate
2828

2929
try
3030
{
31-
$createdChildProfile = New-AzureRmTrafficManagerProfile -Name $childProfileName -ResourceGroupName $resourceGroup.ResourceGroupName -RelativeDnsName $childProfileRelativeName -Ttl 50 -TrafficRoutingMethod "Performance" -MonitorProtocol "HTTP" -MonitorPort 80 -MonitorPath "/testpath.asp"
31+
$createdChildProfile = New-AzureRmTrafficManagerProfile -Name $childProfileName -ResourceGroupName $resourceGroup.ResourceGroupName -RelativeDnsName $childProfileRelativeName -Ttl 50 -TrafficRoutingMethod "Performance" -MonitorProtocol "HTTP" -MonitorPort 80 -MonitorPath "/testpath.asp" -ProfileStatus "Enabled"
3232
Assert-NotNull $createdChildProfile.Id
3333

34-
$createdParentProfile = New-AzureRmTrafficManagerProfile -Name $parentProfileName -ResourceGroupName $resourceGroup.ResourceGroupName -RelativeDnsName $parentProfileRelativeName -Ttl 50 -TrafficRoutingMethod "Performance" -MonitorProtocol "HTTP" -MonitorPort 80 -MonitorPath "/testpath.asp"
35-
$createdParentProfile = Add-AzureRmTrafficManagerEndpointConfig -EndpointName "MyNestedEndpoint" -TrafficManagerProfile $createdParentProfile -Type "NestedEndpoints" -TargetResourceId $createdChildProfile.Id -EndpointStatus "Enabled" -EndpointLocation "North Europe" -MinChildEndpoints 2
36-
$updatedParentProfile = Set-AzureRmTrafficManagerProfile -TrafficManagerProfile $createdParentProfile
34+
$createdParentProfile = New-AzureRmTrafficManagerProfile -Name $parentProfileName -ResourceGroupName $resourceGroup.ResourceGroupName -RelativeDnsName $parentProfileRelativeName -Ttl 50 -TrafficRoutingMethod "Performance" -MonitorProtocol "HTTP" -MonitorPort 80 -MonitorPath "/testpath.asp" -ProfileStatus "Enabled"
35+
$createdEndpoint = New-AzureRmTrafficManagerEndpoint -Name "MyNestedEndpoint" -ProfileName $parentProfileName -ResourceGroupName $resourceGroup.ResourceGroupName -Type "NestedEndpoints" -TargetResourceId $createdChildProfile.Id -EndpointStatus "Enabled" -EndpointLocation "North Europe" -MinChildEndpoints 2
36+
$updatedParentProfile = Get-AzureRmTrafficManagerProfile -Name $parentProfileName -ResourceGroupName $resourceGroup.ResourceGroupName
3737

3838
Assert-NotNull $updatedParentProfile
3939
Assert-AreEqual 1 $updatedParentProfile.Endpoints.Count
@@ -47,7 +47,7 @@ function Test-NestedEndpointsCreateUpdate
4747
Assert-AreEqual 2 $retrievedParentProfile.Endpoints[0].MinChildEndpoints
4848
Assert-AreEqual "North Europe" $retrievedParentProfile.Endpoints[0].Location
4949

50-
$anotherCreatedChildProfile = New-AzureRmTrafficManagerProfile -Name $anotherChildProfileName -ResourceGroupName $resourceGroup.ResourceGroupName -RelativeDnsName $anotherChildProfileRelativeName -Ttl 50 -TrafficRoutingMethod "Performance" -MonitorProtocol "HTTP" -MonitorPort 80 -MonitorPath "/testpath.asp"
50+
$anotherCreatedChildProfile = New-AzureRmTrafficManagerProfile -Name $anotherChildProfileName -ResourceGroupName $resourceGroup.ResourceGroupName -RelativeDnsName $anotherChildProfileRelativeName -Ttl 50 -TrafficRoutingMethod "Performance" -MonitorProtocol "HTTP" -MonitorPort 80 -MonitorPath "/testpath.asp" -ProfileStatus "Enabled"
5151
Assert-NotNull $anotherCreatedChildProfile.Id
5252

5353
$anotherNestedEndpoint = New-AzureRmTrafficManagerEndpoint -Name "MySecondNestedEndpoint" -ProfileName $parentProfileName -ResourceGroupName $resourceGroup.ResourceGroupName -Type "NestedEndpoints" -TargetResourceId $anotherCreatedChildProfile.Id -EndpointStatus "Enabled" -EndpointLocation "West Europe" -MinChildEndpoints 3
@@ -100,16 +100,13 @@ function Test-ProfileWithNestedEndpointsGetPut
100100

101101
try
102102
{
103-
$createdChildProfile = New-AzureRmTrafficManagerProfile -Name $childProfileName -ResourceGroupName $resourceGroup.ResourceGroupName -RelativeDnsName $childProfileRelativeName -Ttl 30 -TrafficRoutingMethod "Performance" -MonitorProtocol "HTTP" -MonitorPort 80 -MonitorPath "/testchild.asp"
103+
$createdChildProfile = New-AzureRmTrafficManagerProfile -Name $childProfileName -ResourceGroupName $resourceGroup.ResourceGroupName -RelativeDnsName $childProfileRelativeName -Ttl 30 -TrafficRoutingMethod "Performance" -MonitorProtocol "HTTP" -MonitorPort 80 -MonitorPath "/testchild.asp" -ProfileStatus "Enabled"
104104
Assert-NotNull $createdChildProfile.Id
105105

106-
$createdParentProfile = New-AzureRmTrafficManagerProfile -Name $parentProfileName -ResourceGroupName $resourceGroup.ResourceGroupName -RelativeDnsName $parentProfileRelativeName -Ttl 51 -TrafficRoutingMethod "Performance" -MonitorProtocol "HTTPS" -MonitorPort 111 -MonitorPath "/testparent.asp"
106+
$createdParentProfile = New-AzureRmTrafficManagerProfile -Name $parentProfileName -ResourceGroupName $resourceGroup.ResourceGroupName -RelativeDnsName $parentProfileRelativeName -Ttl 51 -TrafficRoutingMethod "Performance" -MonitorProtocol "HTTPS" -MonitorPort 111 -MonitorPath "/testparent.asp" -ProfileStatus "Enabled"
107107
$nestedEndpoint = New-AzureRmTrafficManagerEndpoint -Name "MyNestedEndpoint" -ProfileName $parentProfileName -ResourceGroupName $resourceGroup.ResourceGroupName -Type "NestedEndpoints" -TargetResourceId $createdChildProfile.Id -EndpointStatus "Enabled" -EndpointLocation "West Europe" -MinChildEndpoints 1
108108

109109
$retrievedParentProfile = Get-AzureRmTrafficManagerProfile -Name $parentProfileName -ResourceGroupName $resourceGroup.ResourceGroupName
110-
$retrievedParentProfile | Set-AzureRmTrafficManagerProfile
111-
112-
$retrievedParentProfile = Get-AzureRmTrafficManagerProfile -Name $parentProfileName -ResourceGroupName $resourceGroup.ResourceGroupName
113110

114111
Assert-NotNull $retrievedParentProfile
115112
Assert-AreEqual 51 $retrievedParentProfile.Ttl

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,19 @@ public void TestProfileMonitorParameterAliases()
167167
{
168168
TestController.NewInstance.RunPowerShellTest(_logger, "Test-ProfileMonitorParameterAliases");
169169
}
170+
171+
[Fact]
172+
[Trait(Category.AcceptanceType, Category.CheckIn)]
173+
public void TestAddAndRemoveCustomHeadersFromProfile()
174+
{
175+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-AddAndRemoveCustomHeadersFromProfile");
176+
}
177+
178+
[Fact]
179+
[Trait(Category.AcceptanceType, Category.CheckIn)]
180+
public void TestAddAndRemoveExpectedStatusCodeRanges()
181+
{
182+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-AddAndRemoveExpectedStatusCodeRanges");
183+
}
170184
}
171185
}

0 commit comments

Comments
 (0)