Skip to content

Commit a0c7d5b

Browse files
authored
Merge pull request #683 from Azure/dev
huangpf PR: dev <- Azure:dev
2 parents 53a2b86 + acda8fa commit a0c7d5b

File tree

196 files changed

+563663
-191370
lines changed

Some content is hidden

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

196 files changed

+563663
-191370
lines changed

src/ResourceManager/Cdn/AzureRM.Cdn.psd1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ CmdletsToExport = 'Get-AzureRmCdnProfile', 'Get-AzureRmCdnProfileSsoUrl',
8181
'Remove-AzureRmCdnEndpoint', 'Set-AzureRmCdnEndpoint',
8282
'Start-AzureRmCdnEndpoint', 'Stop-AzureRmCdnEndpoint',
8383
'Test-AzureRmCdnCustomDomain', 'Get-AzureRmCdnCustomDomain',
84-
'New-AzureRmCdnCustomDomain', 'Remove-AzureRmCdnCustomDomain'
84+
'New-AzureRmCdnCustomDomain', 'Remove-AzureRmCdnCustomDomain',
85+
'Get-AzureRmCdnProfileResourceUsage', 'Get-AzureRmCdnEndpointResourceUsage',
86+
'Get-AzureRmCdnSubscriptionResourceUsage', 'Get-AzureRmCdnEdgeNodes'
8587

8688
# Variables to export from this module
8789
# VariablesToExport = @()

src/ResourceManager/Cdn/Commands.Cdn.Test/Commands.Cdn.Test.csproj

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<Private>True</Private>
5858
</Reference>
5959
<Reference Include="Microsoft.Azure.Management.Cdn">
60-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Cdn.2.0.0\lib\net45\Microsoft.Azure.Management.Cdn.dll</HintPath>
60+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Cdn.3.0.0-preview\lib\net45\Microsoft.Azure.Management.Cdn.dll</HintPath>
6161
</Reference>
6262
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6363
<SpecificVersion>False</SpecificVersion>
@@ -147,6 +147,9 @@
147147
<None Include="ScenarioTests\ProfileTests.ps1">
148148
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
149149
</None>
150+
<None Include="ScenarioTests\SubscriptionTests.ps1">
151+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
152+
</None>
150153
<None Include="SessionRecords\Microsoft.Azure.Commands.Cdn.Test.ScenarioTests.ScenarioTest.CustomDomainTests\TestCustomDomainGetRemoveWithRunningEndpoint.json">
151154
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
152155
</None>
@@ -192,6 +195,18 @@
192195
<None Include="SessionRecords\Microsoft.Azure.Commands.Cdn.Test.ScenarioTests.ScenarioTest.ProfileTests\TestProfilePipeline.json">
193196
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
194197
</None>
198+
<None Include="SessionRecords\Microsoft.Azure.Commands.Cdn.Test.ScenarioTests.ScenarioTest.ProfileTests\TestProfileGetResourceUsage.json">
199+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
200+
</None>
201+
<None Include="SessionRecords\Microsoft.Azure.Commands.Cdn.Test.ScenarioTests.ScenarioTest.EndpointTests\TestEndpointResourceUsage.json">
202+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
203+
</None>
204+
<None Include="SessionRecords\Microsoft.Azure.Commands.Cdn.Test.ScenarioTests.ScenarioTest.SubscriptionTests\TestSubscriptionGetResourceUsage.json">
205+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
206+
</None>
207+
<None Include="SessionRecords\Microsoft.Azure.Commands.Cdn.Test.ScenarioTests.ScenarioTest.SubscriptionTests\TestSubscriptionEdgeNode.json">
208+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
209+
</None>
195210
</ItemGroup>
196211
<ItemGroup>
197212
<ProjectReference Include="..\..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj">
@@ -228,6 +243,7 @@
228243
<Compile Include="ScenarioTests\EndpointTests.cs" />
229244
<Compile Include="ScenarioTests\OriginTests.cs" />
230245
<Compile Include="ScenarioTests\ProfileTests.cs" />
246+
<Compile Include="ScenarioTests\SubscriptionTests.cs" />
231247
<Compile Include="ScenarioTests\TestController.cs" />
232248
</ItemGroup>
233249
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

src/ResourceManager/Cdn/Commands.Cdn.Test/ScenarioTests/EndpointTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,12 @@ public void TestEndpointGeoFilters()
6969
{
7070
TestController.NewInstance.RunPowerShellTest(_logger, "Test-EndpointGeoFilters");
7171
}
72+
73+
[Fact]
74+
[Trait(Category.AcceptanceType, Category.CheckIn)]
75+
public void TestEndpointResourceUsage()
76+
{
77+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-EndpointResourceUsage");
78+
}
7279
}
7380
}

src/ResourceManager/Cdn/Commands.Cdn.Test/ScenarioTests/EndpointTests.ps1

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,5 +427,33 @@ function Test-EndpointGeoFilters
427427

428428
Assert-True {$updatedEndpoint.GeoFilters.Count -eq 2}
429429

430+
Remove-AzureRmResourceGroup -Name $resourceGroup.ResourceGroupName -Force
431+
}
432+
433+
<#
434+
.SYNOPSIS
435+
Endpoint resource usage exercise
436+
#>
437+
function Test-EndpointResourceUsage
438+
{
439+
$profileName = getAssetName
440+
$resourceGroup = TestSetup-CreateResourceGroup
441+
$resourceLocation = "EastUS"
442+
$profileSku = "Standard_Akamai"
443+
444+
$createdProfile = New-AzureRmCdnProfile -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Location $resourceLocation -Sku $profileSku
445+
446+
$endpointName1 = getAssetName
447+
$originName = getAssetName
448+
$originHostName = "www.microsoft.com"
449+
450+
$createdProfile | New-AzureRmCdnEndpoint -EndpointName $endpointName1 -OriginName $originName -OriginHostName $originHostName
451+
452+
$endpointResourceUsage = Get-AzureRmCdnEndpointResourceUsage -EndpointName $endpointName1 -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName
453+
454+
Assert-True {$endpointResourceUsage.Count -eq 2}
455+
Assert-True {$endpointResourceUsage[0].CurrentValue -eq 0}
456+
Assert-True {$endpointResourceUsage[1].CurrentValue -eq 0}
457+
430458
Remove-AzureRmResourceGroup -Name $resourceGroup.ResourceGroupName -Force
431459
}

src/ResourceManager/Cdn/Commands.Cdn.Test/ScenarioTests/ProfileTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,12 @@ public void TestProfileDeleteWithEndpoints()
5555
{
5656
TestController.NewInstance.RunPowerShellTest(_logger, "Test-ProfileDeleteWithEndpoints");
5757
}
58+
59+
[Fact]
60+
[Trait(Category.AcceptanceType, Category.CheckIn)]
61+
public void TestProfileGetResourceUsage()
62+
{
63+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-ProfileGetResourceUsages");
64+
}
5865
}
5966
}

src/ResourceManager/Cdn/Commands.Cdn.Test/ScenarioTests/ProfileTests.ps1

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,27 @@ function Test-ProfilePipeline
139139

140140
Assert-True { $deletedProfiles.Count -eq 0 }
141141

142+
Remove-AzureRmResourceGroup -Name $resourceGroup.ResourceGroupName -Force
143+
}
144+
145+
<#
146+
.SYNOPSIS
147+
Full Profile ge resource usage excercis
148+
#>
149+
function Test-ProfileGetResourceUsages
150+
{
151+
$profileName = getAssetName
152+
$endpointName = getAssetName
153+
$resourceGroup = TestSetup-CreateResourceGroup
154+
$profileLocation = "EastUS"
155+
$profileSku = "Standard_Akamai"
156+
157+
$createdProfile = New-AzureRmCdnProfile -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Location $profileLocation -Sku $profileSku
158+
159+
$profileResourceUsage = Get-AzureRmCdnProfileResourceUsage -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName
160+
161+
Assert-True {$profileResourceUsage.Count -eq 1}
162+
Assert-True {$profileResourceUsage[0].CurrentValue -eq 0}
163+
142164
Remove-AzureRmResourceGroup -Name $resourceGroup.ResourceGroupName -Force
143165
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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.Cdn.Test.ScenarioTests.ScenarioTest;
16+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
17+
using Xunit;
18+
19+
namespace Microsoft.Azure.Commands.Cdn.Test.ScenarioTests.ScenarioTest
20+
{
21+
public class SubscriptionTests
22+
{
23+
private ServiceManagemenet.Common.Models.XunitTracingInterceptor _logger;
24+
25+
public SubscriptionTests(Xunit.Abstractions.ITestOutputHelper output)
26+
{
27+
_logger = new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output);
28+
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
29+
}
30+
31+
[Fact]
32+
[Trait(Category.AcceptanceType, Category.CheckIn)]
33+
public void TestSubscriptionGetResourceUsage()
34+
{
35+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-SubscriptionGetResourceUsage");
36+
}
37+
38+
[Fact]
39+
[Trait(Category.AcceptanceType, Category.CheckIn)]
40+
public void TestSubscriptionEdgeNode()
41+
{
42+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-SubscriptionEdgeNode");
43+
}
44+
}
45+
}
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+
<#
16+
.SYNOPSIS
17+
Subscription resource usage
18+
#>
19+
function Test-SubscriptionGetResourceUsage
20+
{
21+
$subscriptionResourceUsage = Get-AzureRmCdnSubscriptionResourceUsage
22+
23+
Assert-True {$subscriptionResourceUsage.Count -eq 1}
24+
Assert-True {$subscriptionResourceUsage[0].CurrentValue -eq 0}
25+
}
26+
27+
<#
28+
.SYNOPSIS
29+
Edge node
30+
#>
31+
function Test-SubscriptionEdgeNode
32+
{
33+
$edgeNodes = Get-AzureRmCdnEdgeNodes
34+
35+
Assert-False {$edgeNodes -eq $null}
36+
}

0 commit comments

Comments
 (0)