Skip to content

Commit

Permalink
Add MonitorTestRunner to replace TestsController (#18201)
Browse files Browse the repository at this point in the history
  • Loading branch information
ziyuezh576 authored May 19, 2022
1 parent 3938a0d commit a60a431
Show file tree
Hide file tree
Showing 13 changed files with 131 additions and 359 deletions.
13 changes: 3 additions & 10 deletions src/Monitor/Monitor.Test/ScenarioTests/ActionGroupsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,22 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Xunit;
using Microsoft.Azure.ServiceManagement.Common.Models;

namespace Microsoft.Azure.Commands.Insights.Test.ScenarioTests
{
public class ActionGroupsTests : RMTestBase
public class ActionGroupsTests : MonitorTestRunner
{
public XunitTracingInterceptor _logger;

public ActionGroupsTests(Xunit.Abstractions.ITestOutputHelper output)
public ActionGroupsTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
{
_logger = new XunitTracingInterceptor(output);
XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAddGetListSetRemoveActionGroup()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-AddGetListSetRemoveActionGroup");
TestRunner.RunTestScript("Test-AddGetListSetRemoveActionGroup");
}
}
}
12 changes: 3 additions & 9 deletions src/Monitor/Monitor.Test/ScenarioTests/ActivityLogAlertsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,22 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.ServiceManagement.Common.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Xunit;

namespace Microsoft.Azure.Commands.Insights.Test.ScenarioTests
{
public class ActivityLogAlertsTests : RMTestBase
public class ActivityLogAlertsTests : MonitorTestRunner
{
public XunitTracingInterceptor _logger;

public ActivityLogAlertsTests(Xunit.Abstractions.ITestOutputHelper output)
public ActivityLogAlertsTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
{
_logger = new XunitTracingInterceptor(output);
XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSetGetListUpdateRemoveActivityLogAlert()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-SetGetListUpdateRemoveActivityLogAlert");
TestRunner.RunTestScript("Test-SetGetListUpdateRemoveActivityLogAlert");
}
}
}
16 changes: 5 additions & 11 deletions src/Monitor/Monitor.Test/ScenarioTests/ActivityLogsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,36 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.ServiceManagement.Common.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Xunit;

namespace Microsoft.Azure.Commands.Insights.Test.ScenarioTests
{
public class ActivityLogsTests : RMTestBase
public class ActivityLogsTests : MonitorTestRunner
{
public XunitTracingInterceptor _logger;

public ActivityLogsTests(Xunit.Abstractions.ITestOutputHelper output)
public ActivityLogsTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
{
_logger = new XunitTracingInterceptor(output);
XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetAzureLogAllParameters()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-GetAzureLogAllParameters");
TestRunner.RunTestScript("Test-GetAzureLogAllParameters");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetAzureSubscriptionIdLogMaxEvents()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-GetAzureSubscriptionIdLogMaxEvents");
TestRunner.RunTestScript("Test-GetAzureSubscriptionIdLogMaxEvents");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetAzureSubscriptionIdLogPaged()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-GetAzureSubscriptionIdLogPaged");
TestRunner.RunTestScript("Test-GetAzureSubscriptionIdLogPaged");
}
}
}
46 changes: 20 additions & 26 deletions src/Monitor/Monitor.Test/ScenarioTests/AlertsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,147 +12,141 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.ServiceManagement.Common.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Xunit;

namespace Microsoft.Azure.Commands.Insights.Test.ScenarioTests
{
public class AlertsTests : RMTestBase
public class AlertsTests : MonitorTestRunner
{
public XunitTracingInterceptor _logger;

public AlertsTests(Xunit.Abstractions.ITestOutputHelper output)
public AlertsTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
{
_logger = new XunitTracingInterceptor(output);
XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestNewAzureRmAlertRuleWebhook()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-NewAzureRmAlertRuleWebhook");
TestRunner.RunTestScript("Test-NewAzureRmAlertRuleWebhook");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestNewAzureRmAlertRuleEmail()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-NewAzureRmAlertRuleEmail");
TestRunner.RunTestScript("Test-NewAzureRmAlertRuleEmail");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAddAzureRmMetricAlertRule()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-AddAzureRmMetricAlertRule");
TestRunner.RunTestScript("Test-AddAzureRmMetricAlertRule");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAddAzureRmWebtestAlertRule()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-AddAzureRmWebtestAlertRule");
TestRunner.RunTestScript("Test-AddAzureRmWebtestAlertRule");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetAzureRmAlertRule()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-GetAzureRmAlertRule");
TestRunner.RunTestScript("Test-GetAzureRmAlertRule");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetAzureRmAlertRuleByName()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-GetAzureRmAlertRuleByName");
TestRunner.RunTestScript("Test-GetAzureRmAlertRuleByName");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRemoveAzureRmAlertRule()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-RemoveAzureRmAlertRule");
TestRunner.RunTestScript("Test-RemoveAzureRmAlertRule");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetAzureRmAlertHistory()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-GetAzureRmAlertHistory");
TestRunner.RunTestScript("Test-GetAzureRmAlertHistory");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetAzureRmMetricAlertRuleV2()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-GetAzureRmMetricAlertRuleV2");
TestRunner.RunTestScript("Test-GetAzureRmMetricAlertRuleV2");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRemoveAzureRmMetricAlertRuleV2()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-RemoveAzureRmAlertRuleV2");
TestRunner.RunTestScript("Test-RemoveAzureRmAlertRuleV2");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAddAzureRmMetricAlertRuleV2()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-AddAzureRmMetricAlertRuleV2");
TestRunner.RunTestScript("Test-AddAzureRmMetricAlertRuleV2");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAddAzureRmMetricAlertRuleV2WithoutActionGroup()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-AddAzureRmMetricAlertRuleV2-NoActionGroup");
TestRunner.RunTestScript("Test-AddAzureRmMetricAlertRuleV2-NoActionGroup");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAddAzureRmMetricAlertRuleV2WithActionGroupId()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-AddAzureRmMetricAlertRuleV2-ActionGroupId");
TestRunner.RunTestScript("Test-AddAzureRmMetricAlertRuleV2-ActionGroupId");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAddAzureRmMetricAlertRuleV2WithSkipMetricValidation()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-AddAzureRmMetricAlertRuleV2-SkipMetricValidation");
TestRunner.RunTestScript("Test-AddAzureRmMetricAlertRuleV2-SkipMetricValidation");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAddAzureRmMetricAlertRuleV2WithAutoMitigate()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-AddAzureRmMetricAlertRuleV2-autoMitigate");
TestRunner.RunTestScript("Test-AddAzureRmMetricAlertRuleV2-autoMitigate");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestDisableAzureRmMetricAlertRuleV2WithActionGroups()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-DisableAzureRmMetricAlertRuleV2WithActionGroups");
TestRunner.RunTestScript("Test-DisableAzureRmMetricAlertRuleV2WithActionGroups");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAddAzureRmDynamicMetricAlertRuleV2()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-AddAzureRmMetricAlertRuleV2-DynamicThreshold");
TestRunner.RunTestScript("Test-AddAzureRmMetricAlertRuleV2-DynamicThreshold");
}

[Fact]
[Trait(Category.AcceptanceType, Category.LiveOnly)]
public void TestAddAzureRmWebtestAlertRuleV2()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-AddAzureRmMetricAlertRuleV2-Webtest");
TestRunner.RunTestScript("Test-AddAzureRmMetricAlertRuleV2-Webtest");
}
}
}
24 changes: 9 additions & 15 deletions src/Monitor/Monitor.Test/ScenarioTests/AutoscaleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,70 +12,64 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.ServiceManagement.Common.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Xunit;

namespace Microsoft.Azure.Commands.Insights.Test.ScenarioTests
{
public class AutoscaleTests : RMTestBase
public class AutoscaleTests : MonitorTestRunner
{
public XunitTracingInterceptor _logger;

public AutoscaleTests(Xunit.Abstractions.ITestOutputHelper output)
public AutoscaleTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
{
_logger = new XunitTracingInterceptor(output);
XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAddAzureRmAutoscaleSetting()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-AddAzureRmAutoscaleSetting");
TestRunner.RunTestScript("Test-AddAzureRmAutoscaleSetting");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetAzureRmAutoscaleSetting()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-GetAzureRmAutoscaleSetting");
TestRunner.RunTestScript("Test-GetAzureRmAutoscaleSetting");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetAzureRmAutoscaleSettingByName()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-GetAzureRmAutoscaleSettingByName");
TestRunner.RunTestScript("Test-GetAzureRmAutoscaleSettingByName");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRemoveAzureRmAutoscaleSetting()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-RemoveAzureRmAutoscaleSetting");
TestRunner.RunTestScript("Test-RemoveAzureRmAutoscaleSetting");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetAzureRmAutoscaleHistory()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-GetAzureRmAutoscaleHistory");
TestRunner.RunTestScript("Test-GetAzureRmAutoscaleHistory");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestNewAzureRmAutoscaleNotification()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-NewAzureRmAutoscaleNotification");
TestRunner.RunTestScript("Test-NewAzureRmAutoscaleNotification");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestNewAzureRmAutoscaleWebhook()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-NewAzureRmAutoscaleWebhook");
TestRunner.RunTestScript("Test-NewAzureRmAutoscaleWebhook");
}
}
}
Loading

0 comments on commit a60a431

Please sign in to comment.