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
2 changes: 1 addition & 1 deletion src/Cdn/Cdn.Test/Cdn.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Cdn" Version="4.4.0" />
<PackageReference Include="Microsoft.Azure.Management.Cdn" Version="6.1.0" />
</ItemGroup>

</Project>
44 changes: 44 additions & 0 deletions src/Cdn/Cdn.Test/ScenarioTests/AfdCustomDomainTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;

namespace Microsoft.Azure.Commands.Cdn.Test.ScenarioTests.ScenarioTest
{
public class AfdCustomDomainTests
{
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;

public AfdCustomDomainTests(Xunit.Abstractions.ITestOutputHelper output)
{
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
}

[Fact(Skip = "Test is flaky due to creation of custom domain issue which prolongs response time. Will enable once RP issue is resolved.")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCreateAfdCustomDomain()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-CreateAfdCustomDomain");
}

[Fact(Skip = "Test is flaky due to RP issue which prolongs response time. Will enable once RP issue is resolved.")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetAfdCustomDomain()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-GetAfdCustomDomain");
}
}
}
66 changes: 66 additions & 0 deletions src/Cdn/Cdn.Test/ScenarioTests/AfdCustomDomainTests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------

function Test-CreateAfdCustomDomain
{
# Set up required fields
$resourceGroup = TestSetup-CreateResourceGroup
$resourceGroupName = $resourceGroup.ResourceGroupName
$profileName = getAssetName

# Profile specific properties
$profileSku = "Standard_AzureFrontDoor"

# Create a Microsoft AFD Profile
New-AzAfdProfile -ResourceGroupName $resourceGroupName -ProfileName $profileName -Sku $profileSku

$customDomainName = getAssetName

$hostName = "$customDomainName.azfdtests.xyz"

$customDomain = New-AzAfdCustomDomain -ResourceGroupName $resourceGroupName -ProfileName $profileName -CustomDomainName $customDomainName -HostName $hostName

Assert-AreEqual $customDomain.Name $customDomainName
Assert-AreEqual $customDomain.HostName $hostName

Remove-AzResourceGroup -Name $resourceGroup.ResourceGroupName -Force
}

function Test-GetAfdCustomDomain
{
# Set up required fields
$resourceGroup = TestSetup-CreateResourceGroup
$resourceGroupName = $resourceGroup.ResourceGroupName
$profileName = getAssetName

# Profile specific properties
$profileSku = "Standard_AzureFrontDoor"

# Create a Microsoft AFD Profile
New-AzAfdProfile -ResourceGroupName $resourceGroupName -ProfileName $profileName -Sku $profileSku

$customDomainName = getAssetName

$hostName = "$customDomainName.azfdtests.xyz"

New-AzAfdCustomDomain -ResourceGroupName $resourceGroupName -ProfileName $profileName -CustomDomainName $customDomainName -HostName $hostName

$customDomain = Get-AzAfdCustomDomain -ResourceGroupName $resourceGroupName -ProfileName $profileName -CustomDomainName $customDomainName

Assert-AreEqual $customDomain.Name $customDomainName
Assert-AreEqual $customDomain.HostName $hostName
Assert-AreEqual $customDomain.ProvisioningState "Succeeded"

Remove-AzResourceGroup -Name $resourceGroup.ResourceGroupName -Force
}
58 changes: 58 additions & 0 deletions src/Cdn/Cdn.Test/ScenarioTests/AfdEndpointTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;

namespace Microsoft.Azure.Commands.Cdn.Test.ScenarioTests.ScenarioTest
{
public class AfdEndpointTests
{
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;

public AfdEndpointTests(Xunit.Abstractions.ITestOutputHelper output)
{
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCreateAfdEndpoint()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-CreateAfdEndpoint");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetAfdEndpoint()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-GetAfdEndpoint");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRemoveAfdEndpoint()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-RemoveAfdEndpoint");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSetAfdEndpoint()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-SetAfdEndpoint");
}
}
}
140 changes: 140 additions & 0 deletions src/Cdn/Cdn.Test/ScenarioTests/AfdEndpointTests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------

<#
.SYNOPSIS
Creates a Standard_AzureFrontDoor profile and endpoint
#>

function Test-CreateAfdEndpoint
{
# Set up required fields
$resourceGroup = TestSetup-CreateResourceGroup
$resourceGroupName = $resourceGroup.ResourceGroupName
$profileName = getAssetName

# Profile specific properties
$profileSku = "Standard_AzureFrontDoor"

# Create a Microsoft CDN Profile
$createdProfile = New-AzAfdProfile -ResourceGroupName $resourceGroupName -ProfileName $profileName -Sku $profileSku

Assert-AreEqual $profileName $createdProfile.Name
Assert-AreEqual $profileSku $createdProfile.Sku
Assert-AreEqual $createdProfile.Location "Global"

$endpointName = getAssetName
$responseSeconds = 75

$createdEndpoint = New-AzAfdEndpoint -ResourceGroupName $resourceGroupName -ProfileName $profileName -EndpointName $endpointName -OriginResponseTimeoutSeconds $responseSeconds

Assert-AreEqual $endpointName $createdEndpoint.Name
Assert-AreEqual $responseSeconds $createdEndpoint.OriginResponseTimeoutSeconds

Remove-AzResourceGroup -Name $resourceGroup.ResourceGroupName -Force
}

<#
.SYNOPSIS
Creates a Standard_AzureFrontDoor profile and endpoint, then gets the endpoint
#>

function Test-GetAfdEndpoint
{
# Set up required fields
$resourceGroup = TestSetup-CreateResourceGroup
$resourceGroupName = $resourceGroup.ResourceGroupName
$profileName = getAssetName

# Profile specific properties
$profileSku = "Standard_AzureFrontDoor"

# Create a Microsoft CDN Profile
$createdProfile = New-AzAfdProfile -ResourceGroupName $resourceGroupName -ProfileName $profileName -Sku $profileSku

$endpointName = getAssetName

New-AzAfdEndpoint -ResourceGroupName $resourceGroupName -ProfileName $profileName -EndpointName $endpointName

$endpoint = Get-AzAfdEndpoint -ResourceGroupName $resourceGroupName -ProfileName $profileName -EndpointName $endpointName

Assert-AreEqual $endpointName $endpoint.Name
Assert-AreEqual "Global" $endpoint.Location

Remove-AzResourceGroup -Name $resourceGroup.ResourceGroupName -Force
}

<#
.SYNOPSIS
Creates a Standard_AzureFrontDoor profile and endpoint, then removes the endpoint
#>

function Test-RemoveAfdEndpoint
{
# Set up required fields
$resourceGroup = TestSetup-CreateResourceGroup
$resourceGroupName = $resourceGroup.ResourceGroupName
$profileName = getAssetName

# Profile specific properties
$profileSku = "Standard_AzureFrontDoor"

# Create a Microsoft CDN Profile
$createdProfile = New-AzAfdProfile -ResourceGroupName $resourceGroupName -ProfileName $profileName -Sku $profileSku

$endpointName = getAssetName

$createdEndpoint = New-AzAfdEndpoint -ResourceGroupName $resourceGroupName -ProfileName $profileName -EndpointName $endpointName

$isDeleted = Remove-AzAfdEndpoint -Endpoint $createdEndpoint -PassThru

Assert-AreEqual $isDeleted true

Remove-AzResourceGroup -Name $resourceGroup.ResourceGroupName -Force
}

<#
.SYNOPSIS
Creates a Standard_AzureFrontDoor profile and endpoint, then updates the endpoint
#>

function Test-SetAfdEndpoint
{
# Set up required fields
$resourceGroup = TestSetup-CreateResourceGroup
$resourceGroupName = $resourceGroup.ResourceGroupName
$profileName = getAssetName

# Profile specific properties
$profileSku = "Standard_AzureFrontDoor"

# Create a Microsoft CDN Profile
$createdProfile = New-AzAfdProfile -ResourceGroupName $resourceGroupName -ProfileName $profileName -Sku $profileSku

$endpointName = getAssetName

New-AzAfdEndpoint -ResourceGroupName $resourceGroupName -ProfileName $profileName -EndpointName $endpointName

$endpoint = Get-AzAfdEndpoint -ResourceGroupName $resourceGroupName -ProfileName $profileName -EndpointName $endpointName

$endpoint.Tags = @{"endpoint"="afd-standard"}
$endpoint.OriginResponseTimeoutSeconds = 100

$updatedEndpoint = Set-AzAfdEndpoint -Endpoint $endpoint

Assert-AreEqual $endpoint.OriginResponseTimeoutSeconds $updatedEndpoint.OriginResponseTimeoutSeconds
Assert-AreEqual $endpoint.Tags["endpoint"] $updatedEndpoint.Tags["endpoint"]

Remove-AzResourceGroup -Name $resourceGroup.ResourceGroupName -Force
}
58 changes: 58 additions & 0 deletions src/Cdn/Cdn.Test/ScenarioTests/AfdOriginGroupTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;

namespace Microsoft.Azure.Commands.Cdn.Test.ScenarioTests.ScenarioTest
{
public class AfdOriginGroupTests
{
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;

public AfdOriginGroupTests(Xunit.Abstractions.ITestOutputHelper output)
{
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCreateAfdOriginGroup()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-CreateAfdOriginGroup");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetAfdOriginGroup()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-GetAfdOriginGroup");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSetAfdOriginGroup()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-SetAfdOriginGroup");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRemoveAfdOriginGroup()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-RemoveAfdOriginGroup");
}
}
}
Loading