Skip to content

Commit 8f95ec6

Browse files
committed
[Insights] Updating and improving the tests in general.
1 parent faabfab commit 8f95ec6

21 files changed

+386
-547
lines changed

src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" />
3+
<Import Project="..\..\..\packages\xunit.runner.visualstudio.2.3.0-beta2-build1317\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\..\packages\xunit.runner.visualstudio.2.3.0-beta2-build1317\build\net20\xunit.runner.visualstudio.props')" />
44
<Import Project="..\..\..\packages\xunit.core.2.1.0\build\portable-net45+win8+wp8+wpa81\xunit.core.props" Condition="Exists('..\..\..\packages\xunit.core.2.1.0\build\portable-net45+win8+wp8+wpa81\xunit.core.props')" />
55
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
66
<PropertyGroup>
@@ -62,29 +62,40 @@
6262
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll</HintPath>
6363
</Reference>
6464
<Reference Include="Microsoft.Azure.Management.Monitor">
65-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Monitor.0.16.0-preview\lib\net452\Microsoft.Azure.Management.Monitor.dll</HintPath>
65+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Monitor.0.16.1-preview\lib\net452\Microsoft.Azure.Management.Monitor.dll</HintPath>
6666
</Reference>
6767
<Reference Include="Microsoft.Azure.Test.Framework">
6868
<SpecificVersion>False</SpecificVersion>
6969
<HintPath>..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.6179.26854-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll</HintPath>
7070
</Reference>
7171
<Reference Include="Microsoft.Azure.Test.HttpRecorder">
72-
<HintPath>..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.6.7-preview\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll</HintPath>
72+
<HintPath>..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.7.0\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll</HintPath>
7373
<Private>True</Private>
7474
</Reference>
7575
<Reference Include="Microsoft.Bcl.Build">
7676
<SpecificVersion>False</SpecificVersion>
7777
<HintPath>..\..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.Tasks.dll</HintPath>
7878
</Reference>
79+
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory">
80+
<SpecificVersion>False</SpecificVersion>
81+
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.28.3\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
82+
</Reference>
83+
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms, Version=2.28.3.860, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
84+
<SpecificVersion>False</SpecificVersion>
85+
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.28.3\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
86+
</Reference>
7987
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
80-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.5\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
88+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.8\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
8189
<Private>True</Private>
8290
</Reference>
8391
<Reference Include="Microsoft.Rest.ClientRuntime.Azure">
84-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.5\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
92+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.8\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
93+
</Reference>
94+
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication">
95+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.3.1\lib\net452\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>
8596
</Reference>
8697
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.TestFramework">
87-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.5.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll</HintPath>
98+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.7.2\lib\net452\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll</HintPath>
8899
<Private>True</Private>
89100
</Reference>
90101
<Reference Include="Moq, Version=4.2.1510.2205, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
@@ -105,19 +116,20 @@
105116
<Reference Include="System.Net.Http" />
106117
<Reference Include="System.Xml" />
107118
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
108-
<HintPath>..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
119+
<HintPath>..\..\..\packages\xunit.abstractions.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.abstractions.dll</HintPath>
109120
<Private>True</Private>
110121
</Reference>
111-
<Reference Include="xunit.assert, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
122+
<Reference Include="xunit.assert">
112123
<HintPath>..\..\..\packages\xunit.assert.2.1.0\lib\portable-net45+win8+wp8+wpa81\xunit.assert.dll</HintPath>
113124
<Private>True</Private>
114125
</Reference>
115-
<Reference Include="xunit.core, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
126+
<Reference Include="xunit.core">
116127
<HintPath>..\..\..\packages\xunit.extensibility.core.2.1.0\lib\portable-net45+win8+wp8+wpa81\xunit.core.dll</HintPath>
117128
<Private>True</Private>
118129
</Reference>
119-
<Reference Include="xunit.execution.desktop, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
130+
<Reference Include="xunit.execution.desktop">
120131
<HintPath>..\..\..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath>
132+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
121133
<Private>True</Private>
122134
</Reference>
123135
</ItemGroup>
@@ -291,19 +303,7 @@
291303
<None Include="SessionRecords\Microsoft.Azure.Commands.Insights.Test.ScenarioTests.AutoscaleTests\TestRemoveAzureRmAutoscaleSetting.json">
292304
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
293305
</None>
294-
<None Include="SessionRecords\Microsoft.Azure.Commands.Insights.Test.ScenarioTests.ActivityLogsTests\TestGetAzureCorrelationIdLog.json">
295-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
296-
</None>
297-
<None Include="SessionRecords\Microsoft.Azure.Commands.Insights.Test.ScenarioTests.ActivityLogsTests\TestGetAzureResourceGroupLog.json">
298-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
299-
</None>
300-
<None Include="SessionRecords\Microsoft.Azure.Commands.Insights.Test.ScenarioTests.ActivityLogsTests\TestGetAzureResourceLog.json">
301-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
302-
</None>
303-
<None Include="SessionRecords\Microsoft.Azure.Commands.Insights.Test.ScenarioTests.ActivityLogsTests\TestGetAzureResourceProviderLog.json">
304-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
305-
</None>
306-
<None Include="SessionRecords\Microsoft.Azure.Commands.Insights.Test.ScenarioTests.ActivityLogsTests\TestGetAzureSubscriptionIdLog.json">
306+
<None Include="SessionRecords\Microsoft.Azure.Commands.Insights.Test.ScenarioTests.ActivityLogsTests\TestGetAzureLogAllParameters.json">
307307
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
308308
</None>
309309
<None Include="SessionRecords\Microsoft.Azure.Commands.Insights.Test.ScenarioTests.MetricsTests\TestGetMetrics.json">

src/ResourceManager/Insights/Commands.Insights.Test/ScenarioTests/ActivityLogsTests.cs

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using System;
1615
using Microsoft.WindowsAzure.Commands.ScenarioTest;
1716
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
1817
using Xunit;
@@ -27,49 +26,21 @@ public ActivityLogsTests(Xunit.Abstractions.ITestOutputHelper output)
2726
}
2827

2928
[Fact]
30-
[Trait(Category.AcceptanceType, Category.CheckIn)]
31-
public void TestGetAzureCorrelationIdLog()
29+
[Trait(Category.AcceptanceType, "Scenario")]
30+
public void TestGetAzureLogAllParameters()
3231
{
33-
TestsController.NewInstance.RunPsTest("Test-GetAzureCorrelationIdLog");
32+
TestsController.NewInstance.RunPsTest("Test-GetAzureLogAllParameters");
3433
}
3534

3635
[Fact]
37-
[Trait(Category.AcceptanceType, Category.CheckIn)]
38-
public void TestGetAzureResourceGroupLog()
39-
{
40-
TestsController.NewInstance.RunPsTest("Test-GetAzureResourceGroupLog");
41-
}
42-
43-
[Fact]
44-
[Trait(Category.AcceptanceType, Category.CheckIn)]
45-
public void TestGetAzureResourceLog()
46-
{
47-
TestsController.NewInstance.RunPsTest("Test-GetAzureResourceLog");
48-
}
49-
50-
[Fact]
51-
[Trait(Category.AcceptanceType, Category.CheckIn)]
52-
public void TestGetAzureResourceProviderLog()
53-
{
54-
TestsController.NewInstance.RunPsTest("Test-GetAzureResourceProviderLog");
55-
}
56-
57-
[Fact]
58-
[Trait(Category.AcceptanceType, Category.CheckIn)]
59-
public void TestGetAzureSubscriptionIdLog()
60-
{
61-
TestsController.NewInstance.RunPsTest("Test-GetAzureSubscriptionIdLog");
62-
}
63-
64-
[Fact]
65-
[Trait(Category.AcceptanceType, Category.CheckIn)]
36+
[Trait(Category.AcceptanceType, "Scenario")]
6637
public void TestGetAzureSubscriptionIdLogMaxEvents()
6738
{
6839
TestsController.NewInstance.RunPsTest("Test-GetAzureSubscriptionIdLogMaxEvents");
6940
}
7041

7142
[Fact]
72-
[Trait(Category.AcceptanceType, Category.CheckIn)]
43+
[Trait(Category.AcceptanceType, "Scenario")]
7344
public void TestGetAzureSubscriptionIdLogPaged()
7445
{
7546
TestsController.NewInstance.RunPsTest("Test-GetAzureSubscriptionIdLogPaged");

src/ResourceManager/Insights/Commands.Insights.Test/ScenarioTests/ActivityLogsTests.ps1

Lines changed: 10 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -16,107 +16,42 @@
1616
.SYNOPSIS
1717
Tests getting the logs associated to a correlation Id.
1818
#>
19-
function Test-GetAzureCorrelationIdLog
19+
function Test-GetAzureLogAllParameters
2020
{
2121
# Setup
2222
$correlation = '/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNjcmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2ViLUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBjLTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NjA5MjE5ODU0NzQ1NDI0'
23+
$rgname = 'Default-Web-EastUS'
24+
$rname = '/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d'
25+
$rpname = 'microsoft.insights'
2326

2427
try
2528
{
26-
# Test
29+
Write-Verbose " ****** Get ActivityLog records by corrrelationId "
2730
$actual = Get-AzureRmLog -CorrelationId $correlation -starttime 2015-03-02T18:00:00Z -endtime 2015-03-02T20:00:00Z -detailedOutput
2831

2932
# Assert TODO add more asserts
3033
Assert-AreEqual 2 $actual.Count
31-
}
32-
finally
33-
{
34-
# Cleanup
35-
# No cleanup needed for now
36-
}
37-
}
3834

39-
<#
40-
.SYNOPSIS
41-
Tests getting the logs associated to a resource group.
42-
#>
43-
function Test-GetAzureResourceGroupLog
44-
{
45-
# Setup
46-
$rgname = 'Default-Web-EastUS'
47-
48-
try
49-
{
50-
$actual = Get-AzureRmLog -ResourceGroup $rgname -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z
35+
Write-Verbose " ****** Get ActivityLog records by resource group "
36+
$actual = Get-AzureRmLog -ResourceGroup $rgname -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z
5137

5238
# Assert TODO add more asserts
5339
Assert-AreEqual 2 $actual.Count
54-
}
55-
finally
56-
{
57-
# Cleanup
58-
# No cleanup needed for now
59-
}
60-
}
61-
62-
<#
63-
.SYNOPSIS
64-
Tests getting the logs associated to a resource Id.
65-
#>
66-
function Test-GetAzureResourceLog
67-
{
68-
# Setup
69-
$rname = '/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d'
7040

71-
try
72-
{
41+
Write-Verbose " ****** Get ActivityLog records by resource Id"
7342
$actual = Get-AzureRmLog -ResourceId $rname -startTime 2015-03-03T15:42:50Z -endTime 2015-03-03T16:42:50Z
7443

7544
# Assert TODO add more asserts
7645
# Assert-Throws { Set-AzureResourceGroup -Name $rgname -Tags @{"testtag" = "testval"} } "Invalid tag format. Expect @{Name = `"tagName`"} or @{Name = `"tagName`"; Value = `"tagValue`"}"
7746
Assert-AreEqual 2 $actual.Count
78-
}
79-
finally
80-
{
81-
# Cleanup
82-
# No cleanup needed for now
83-
}
84-
}
85-
86-
<#
87-
.SYNOPSIS
88-
Tests getting the logs associated to a resource provider.
89-
#>
90-
function Test-GetAzureResourceProviderLog
91-
{
92-
# Setup
93-
$rpname = 'microsoft.insights'
9447

95-
try
96-
{
48+
Write-Verbose " ****** Get ActivityLog records by resource provider"
9749
$actual = Get-AzureRmLog -ResourceProvider $rpname -startTime 2015-03-03T15:42:50Z -endTime 2015-03-03T16:42:50Z
9850

9951
# Assert
10052
Assert-AreEqual 2 $actual.Count
101-
}
102-
finally
103-
{
104-
# Cleanup
105-
# No cleanup needed for now
106-
}
107-
}
10853

109-
<#
110-
.SYNOPSIS
111-
Tests getting the logs for a subscription Id.
112-
#>
113-
function Test-GetAzureSubscriptionIdLog
114-
{
115-
# No Setup needed
116-
117-
try
118-
{
119-
# Test
54+
Write-Verbose " ****** Get ActivityLog records by subscription Id"
12055
$actual = Get-AzureRmLog -starttime 2015-01-15T12:30:00Z -endtime 2015-01-15T20:30:00Z
12156

12257
# Assert

src/ResourceManager/Insights/Commands.Insights.Test/ScenarioTests/AlertsTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,63 +26,63 @@ public AlertsTests(Xunit.Abstractions.ITestOutputHelper output)
2626
}
2727

2828
[Fact]
29-
[Trait(Category.AcceptanceType, Category.CheckIn)]
29+
[Trait(Category.AcceptanceType, "Scenario")]
3030
public void TestNewAzureRmAlertRuleWebhook()
3131
{
3232
TestsController.NewInstance.RunPsTest("Test-NewAzureRmAlertRuleWebhook");
3333
}
3434

3535
[Fact]
36-
[Trait(Category.AcceptanceType, Category.CheckIn)]
36+
[Trait(Category.AcceptanceType, "Scenario")]
3737
public void TestNewAzureRmAlertRuleEmail()
3838
{
3939
TestsController.NewInstance.RunPsTest("Test-NewAzureRmAlertRuleEmail");
4040
}
4141

4242
[Fact]
43-
[Trait(Category.AcceptanceType, Category.CheckIn)]
43+
[Trait(Category.AcceptanceType, "Scenario")]
4444
public void TestAddAzureRmMetricAlertRule()
4545
{
4646
TestsController.NewInstance.RunPsTest("Test-AddAzureRmMetricAlertRule");
4747
}
4848

4949
[Fact]
50-
[Trait(Category.AcceptanceType, Category.CheckIn)]
50+
[Trait(Category.AcceptanceType, "Scenario")]
5151
public void TestAddAzureRmLogAlertRule()
5252
{
5353
TestsController.NewInstance.RunPsTest("Test-AddAzureRmLogAlertRule");
5454
}
5555

5656
[Fact]
57-
[Trait(Category.AcceptanceType, Category.CheckIn)]
57+
[Trait(Category.AcceptanceType, "Scenario")]
5858
public void TestAddAzureRmWebtestAlertRule()
5959
{
6060
TestsController.NewInstance.RunPsTest("Test-AddAzureRmWebtestAlertRule");
6161
}
6262

6363
[Fact]
64-
[Trait(Category.AcceptanceType, Category.CheckIn)]
64+
[Trait(Category.AcceptanceType, "Scenario")]
6565
public void TestGetAzureRmAlertRule()
6666
{
6767
TestsController.NewInstance.RunPsTest("Test-GetAzureRmAlertRule");
6868
}
6969

7070
[Fact]
71-
[Trait(Category.AcceptanceType, Category.CheckIn)]
71+
[Trait(Category.AcceptanceType, "Scenario")]
7272
public void TestGetAzureRmAlertRuleByName()
7373
{
7474
TestsController.NewInstance.RunPsTest("Test-GetAzureRmAlertRuleByName");
7575
}
7676

7777
[Fact]
78-
[Trait(Category.AcceptanceType, Category.CheckIn)]
78+
[Trait(Category.AcceptanceType, "Scenario")]
7979
public void TestRemoveAzureRmAlertRule()
8080
{
8181
TestsController.NewInstance.RunPsTest("Test-RemoveAzureRmAlertRule");
8282
}
8383

8484
[Fact]
85-
[Trait(Category.AcceptanceType, Category.CheckIn)]
85+
[Trait(Category.AcceptanceType, "Scenario")]
8686
public void TestGetAzureRmAlertHistory()
8787
{
8888
TestsController.NewInstance.RunPsTest("Test-GetAzureRmAlertHistory");

0 commit comments

Comments
 (0)