Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SecurityTestRunner to replace TestController #18189

Merged
merged 2 commits into from
May 19, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,29 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

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

namespace Microsoft.Azure.Commands.Security.Test.ScenarioTests
{
public class AlertsSuppressionRuleTests
public class AlertsSuppressionRuleTests : SecurityTestRunner
{
private readonly XunitTracingInterceptor _logger;

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetSubscriptionScope()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzAlertsSuppressionRule-SubscriptionScope");
TestRunner.RunTestScript("Get-AzAlertsSuppressionRule-SubscriptionScope");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void CreateAndDeleteAlertsSuppressionRule()
{
TestController.NewInstance.RunPowerShellTest(_logger, "CreateAndDelete-AzAlertsSuppressionRule");
TestRunner.RunTestScript("CreateAndDelete-AzAlertsSuppressionRule");
}
}
}
20 changes: 6 additions & 14 deletions src/Security/Security.Test/ScenarioTests/AllowedConnectionTests.cs
Original file line number Diff line number Diff line change
@@ -1,41 +1,33 @@
using Microsoft.Azure.Commands.ScenarioTest;
using Microsoft.Azure.ServiceManagement.Common.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;

namespace Microsoft.Azure.Commands.Security.Test.ScenarioTests
{
public class AllowedConnectionTests
public class AllowedConnectionTests : SecurityTestRunner
{
private readonly XunitTracingInterceptor _logger;

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetSubscriptionScope()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzureRmAllowedConnection-SubscriptionScope");
TestRunner.RunTestScript("Get-AzureRmAllowedConnection-SubscriptionScope");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetResourceGroupLevelResource()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzureRmAllowedConnection-ResourceGroupLevelResource");
TestRunner.RunTestScript("Get-AzureRmAllowedConnection-ResourceGroupLevelResource");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetResourceId()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzureRmAllowedConnection-ResourceId");
TestRunner.RunTestScript("Get-AzureRmAllowedConnection-ResourceId");
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,43 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

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

namespace Microsoft.Azure.Commands.Security.Test.ScenarioTests
{
public class DeviceSecurityGroupsTests
public class DeviceSecurityGroupsTests : SecurityTestRunner
{
private readonly XunitTracingInterceptor _logger;

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetResourceIdScope()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzureRmDeviceSecurityGroup-ResourceIdScope");
TestRunner.RunTestScript("Get-AzureRmDeviceSecurityGroup-ResourceIdScope");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetResourceIdLevelResource()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzureRmDeviceSecurityGroup-ResourceIdLevelResource");
TestRunner.RunTestScript("Get-AzureRmDeviceSecurityGroup-ResourceIdLevelResource");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void SetResourceIdLevelResource()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Set-AzureRmDeviceSecurityGroup-ResourceIdLevelResource");
TestRunner.RunTestScript("Set-AzureRmDeviceSecurityGroup-ResourceIdLevelResource");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void RemoveDeviceSecurityGroups()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Remove-AzureRmDeviceSecurityGroup-ResourceIdLevelResource");
TestRunner.RunTestScript("Remove-AzureRmDeviceSecurityGroup-ResourceIdLevelResource");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,43 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

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

namespace Microsoft.Azure.Commands.Security.Test.ScenarioTests
{
public class IotSecuritySolutionAnalyticsTests
public class IotSecuritySolutionAnalyticsTests : SecurityTestRunner
{
private readonly XunitTracingInterceptor _logger;

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetSolutionScopeSingle()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzureRmIotSecurityAnalytics-SolutionScope-Single");
TestRunner.RunTestScript("Get-AzureRmIotSecurityAnalytics-SolutionScope-Single");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetSolutionScopeList()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzureRmIotSecurityAnalytics-SolutionScope-List");
TestRunner.RunTestScript("Get-AzureRmIotSecurityAnalytics-SolutionScope-List");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetAggregatedAlertSolutionScope()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzureRmIotSecurityAnalyticsAggregatedAlert-SolutionScope");
TestRunner.RunTestScript("Get-AzureRmIotSecurityAnalyticsAggregatedAlert-SolutionScope");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetAggregatedRecommendationSolutionScope()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzureRmIotSecurityAnalyticsAggregatedRecommendation-SolutionScope");
TestRunner.RunTestScript("Get-AzureRmIotSecurityAnalyticsAggregatedRecommendation-SolutionScope");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,106 +12,99 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

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

namespace Microsoft.Azure.Commands.Security.Test.ScenarioTests
{
public class IotSecuritySolutionsTests
public class IotSecuritySolutionsTests : SecurityTestRunner
{
private readonly XunitTracingInterceptor _logger;

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetSubscriptionScope()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzureRmIotSecuritySolution-SubscriptionScope");
TestRunner.RunTestScript("Get-AzureRmIotSecuritySolution-SubscriptionScope");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetResourceGroupScope()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzureRmIotSecuritySolution-ResourceGroupScope");
TestRunner.RunTestScript("Get-AzureRmIotSecuritySolution-ResourceGroupScope");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetResourceGroupLevelResource()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzureRmIotSecuritySolution-ResourceGroupLevelResource");
TestRunner.RunTestScript("Get-AzureRmIotSecuritySolution-ResourceGroupLevelResource");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetResourceId()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzureRmIotSecuritySolution-ResourceId");
TestRunner.RunTestScript("Get-AzureRmIotSecuritySolution-ResourceId");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void SetResourceGroupLevelResource()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Set-AzureRmIotSecuritySolution-ResourceGroupLevelResource");
TestRunner.RunTestScript("Set-AzureRmIotSecuritySolution-ResourceGroupLevelResource");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void SetResourceId()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Set-AzureRmIotSecuritySolution-ResourceId");
TestRunner.RunTestScript("Set-AzureRmIotSecuritySolution-ResourceId");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void SetInputObject()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Set-AzureRmIotSecuritySolution-InputObject");
TestRunner.RunTestScript("Set-AzureRmIotSecuritySolution-InputObject");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void RemoveResourceGroupLevelResource()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Remove-AzureRmIotSecuritySolution-ResourceGroupLevelResource");
TestRunner.RunTestScript("Remove-AzureRmIotSecuritySolution-ResourceGroupLevelResource");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void RemoveResourceId()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Remove-AzureRmIotSecuritySolution-ResourceId");
TestRunner.RunTestScript("Remove-AzureRmIotSecuritySolution-ResourceId");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void UpdateResourceGroupLevelResource()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Update-AzureRmIotSecuritySolution-ResourceGroupLevelResource");
TestRunner.RunTestScript("Update-AzureRmIotSecuritySolution-ResourceGroupLevelResource");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void UpdateResourceId()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Update-AzureRmIotSecuritySolution-ResourceId");
TestRunner.RunTestScript("Update-AzureRmIotSecuritySolution-ResourceId");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void UpdateInputObject()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Update-AzureRmIotSecuritySolution-InputObject");
TestRunner.RunTestScript("Update-AzureRmIotSecuritySolution-InputObject");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
using Microsoft.Azure.Commands.ScenarioTest;
using Microsoft.Azure.ServiceManagement.Common.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;

namespace Microsoft.Azure.Commands.Security.Test.ScenarioTests
{
public class SecurityAdaptiveApplicationControlTests
public class SecurityAdaptiveApplicationControlTests : SecurityTestRunner
{
private readonly XunitTracingInterceptor _logger;

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetAdaptiveApplicationControlGroup()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSecurityAdaptiveApplicationControlGroup-ResourceGroupScope");
TestRunner.RunTestScript("Get-AzSecurityAdaptiveApplicationControlGroup-ResourceGroupScope");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetAdaptiveApplicationControlList()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Get-AzSecurityAdaptiveApplicationControl-SubscriptionScope");
TestRunner.RunTestScript("Get-AzSecurityAdaptiveApplicationControl-SubscriptionScope");
}
}
}

Loading