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 TestRunner and remove TestBase in RecoveryServices #18617

Merged
merged 3 commits into from
Jun 21, 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 @@ -14,29 +14,38 @@

using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Xunit;

namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests
{
public partial class ContainerTests : RMTestBase
public partial class ContainerTests : RecoveryServicesBackupTestRunner
{
private readonly string _AzureFilescommonModule = $"ScenarioTests/{PsBackupProviderTypes.AzureFiles}/Common.ps1";
private readonly string _AzureFilestestModule = $"ScenarioTests/{PsBackupProviderTypes.AzureFiles}/ContainerTests.ps1";

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureFS)]
public void TestAzureFSContainer()
{
TestController.NewInstance.RunPsTest(
_logger, PsBackupProviderTypes.AzureFiles, "Test-AzureFSContainer");
TestRunner.RunTestScript(
$"Import-Module {_AzureFilescommonModule.AsAbsoluteLocation()}",
$"Import-Module {_AzureFilestestModule.AsAbsoluteLocation()}",
"Test-AzureFSContainer"
);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureFS)]
public void TestAzureFSUnregisterContainer()
{
TestController.NewInstance.RunPsTest(
_logger, PsBackupProviderTypes.AzureFiles, "Test-AzureFSUnregisterContainer");
TestRunner.RunTestScript(
$"Import-Module {_AzureFilescommonModule.AsAbsoluteLocation()}",
$"Import-Module {_AzureFilestestModule.AsAbsoluteLocation()}",
"Test-AzureFSUnregisterContainer"
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,56 +14,74 @@

using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Xunit;

namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests
{
public partial class ItemTests : RMTestBase
public partial class ItemTests : RecoveryServicesBackupTestRunner
{
private readonly string _AzureFilescommonModule = $"ScenarioTests/{PsBackupProviderTypes.AzureFiles}/Common.ps1";
private readonly string _AzureFilestestModule = $"ScenarioTests/{PsBackupProviderTypes.AzureFiles}/ItemTests.ps1";

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureFS)]
public void TestAzureFSItem()
{
TestController.NewInstance.RunPsTest(
_logger, PsBackupProviderTypes.AzureFiles, "Test-AzureFSItem");
TestRunner.RunTestScript(
$"Import-Module {_AzureFilescommonModule.AsAbsoluteLocation()}",
$"Import-Module {_AzureFilestestModule.AsAbsoluteLocation()}",
"Test-AzureFSItem"
);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureFS)]
public void TestAzureFSBackup()
{
TestController.NewInstance.RunPsTest(
_logger, PsBackupProviderTypes.AzureFiles, "Test-AzureFSBackup");
TestRunner.RunTestScript(
$"Import-Module {_AzureFilescommonModule.AsAbsoluteLocation()}",
$"Import-Module {_AzureFilestestModule.AsAbsoluteLocation()}",
"Test-AzureFSBackup"
);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureFS)]
public void TestAzureFSGetRPs()
{
TestController.NewInstance.RunPsTest(
_logger, PsBackupProviderTypes.AzureFiles, "Test-AzureFSGetRPs");
TestRunner.RunTestScript(
$"Import-Module {_AzureFilescommonModule.AsAbsoluteLocation()}",
$"Import-Module {_AzureFilestestModule.AsAbsoluteLocation()}",
"Test-AzureFSGetRPs"
);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureFS)]
public void TestAzureFSProtection()
{
TestController.NewInstance.RunPsTest(
_logger, PsBackupProviderTypes.AzureFiles, "Test-AzureFSProtection");
TestRunner.RunTestScript(
$"Import-Module {_AzureFilescommonModule.AsAbsoluteLocation()}",
$"Import-Module {_AzureFilestestModule.AsAbsoluteLocation()}",
"Test-AzureFSProtection"
);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureFS)]
public void TestAzureFSFullRestore()
{
TestController.NewInstance.RunPsTest(
_logger, PsBackupProviderTypes.AzureFiles, "Test-AzureFSFullRestore");
TestRunner.RunTestScript(
$"Import-Module {_AzureFilescommonModule.AsAbsoluteLocation()}",
$"Import-Module {_AzureFilestestModule.AsAbsoluteLocation()}",
"Test-AzureFSFullRestore"
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,50 @@

using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Xunit;

namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests
{
public partial class JobTests : RMTestBase
public partial class JobTests : RecoveryServicesBackupTestRunner
{
private readonly string _AzureFilescommonModule = $"ScenarioTests/{PsBackupProviderTypes.AzureFiles}/Common.ps1";
private readonly string _AzureFilestestModule = $"ScenarioTests/{PsBackupProviderTypes.AzureFiles}/JobTests.ps1";

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureFS)]
public void TestAzureFSGetJob()
{
TestController.NewInstance.RunPsTest(
_logger, PsBackupProviderTypes.AzureFiles, "Test-AzureFSGetJob");
TestRunner.RunTestScript(
$"Import-Module {_AzureFilescommonModule.AsAbsoluteLocation()}",
$"Import-Module {_AzureFilestestModule.AsAbsoluteLocation()}",
"Test-AzureFSGetJob"
);
}

[Fact(Skip = "Job not cancellable everytime")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureFS)]
public void TestAzureFSCancelJob()
{
TestController.NewInstance.RunPsTest(
_logger, PsBackupProviderTypes.AzureFiles, "Test-AzureFSCancelJob");
TestRunner.RunTestScript(
$"Import-Module {_AzureFilescommonModule.AsAbsoluteLocation()}",
$"Import-Module {_AzureFilestestModule.AsAbsoluteLocation()}",
"Test-AzureFSCancelJob"
);
}

[Fact(Skip = "To be fixed in upcoming release")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureFS)]
public void TestAzureFSWaitJob()
{
TestController.NewInstance.RunPsTest(
_logger, PsBackupProviderTypes.AzureFiles, "Test-AzureFSWaitJob");
TestRunner.RunTestScript(
$"Import-Module {_AzureFilescommonModule.AsAbsoluteLocation()}",
$"Import-Module {_AzureFilestestModule.AsAbsoluteLocation()}",
"Test-AzureFSWaitJob"
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,38 @@

using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Xunit;

namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests
{
public partial class PolicyTests : RMTestBase
public partial class PolicyTests : RecoveryServicesBackupTestRunner
{
private readonly string _AzureFilescommonModule = $"ScenarioTests/{PsBackupProviderTypes.AzureFiles}/Common.ps1";
private readonly string _AzureFilestestModule = $"ScenarioTests/{PsBackupProviderTypes.AzureFiles}/PolicyTests.ps1";

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureFS)]
public void TestAzureFSPolicy()
{
TestController.NewInstance.RunPsTest(
_logger, PsBackupProviderTypes.AzureFiles, "Test-AzureFSPolicy");
TestRunner.RunTestScript(
$"Import-Module {_AzureFilescommonModule.AsAbsoluteLocation()}",
$"Import-Module {_AzureFilestestModule.AsAbsoluteLocation()}",
"Test-AzureFSPolicy"
);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureFS)]
public void TestAzureFSHourlyPolicy()
{
TestController.NewInstance.RunPsTest(
_logger, PsBackupProviderTypes.AzureFiles, "Test-AzureFSHourlyPolicy");
TestRunner.RunTestScript(
$"Import-Module {_AzureFilescommonModule.AsAbsoluteLocation()}",
$"Import-Module {_AzureFilestestModule.AsAbsoluteLocation()}",
"Test-AzureFSHourlyPolicy"
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,26 @@

using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Xunit;

namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests
{
public partial class ProtectionCheckTests : RMTestBase
public partial class ProtectionCheckTests : RecoveryServicesBackupTestRunner
{
private readonly string _AzureFilescommonModule = $"ScenarioTests/{PsBackupProviderTypes.AzureFiles}/Common.ps1";
private readonly string _AzureFilestestModule = $"ScenarioTests/{PsBackupProviderTypes.AzureFiles}/ProtectionCheckTests.ps1";

[Fact(Skip = "To un-skip in upcoming release")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureFS)]
public void TestAzureFSProtectionCheck()
{
TestController.NewInstance.RunPsTest(
_logger, PsBackupProviderTypes.AzureFiles, "Test-AzureFSProtectionCheck");
TestRunner.RunTestScript(
$"Import-Module {_AzureFilescommonModule.AsAbsoluteLocation()}",
$"Import-Module {_AzureFilestestModule.AsAbsoluteLocation()}",
"Test-AzureFSProtectionCheck"
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,43 @@
// ----------------------------------------------------------------------------------

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

namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests
{
public partial class ContainerTests : RMTestBase
public partial class ContainerTests : RecoveryServicesBackupTestRunner
{
public XunitTracingInterceptor _logger;
private readonly string _AzureSqlcommonModule = $"ScenarioTests/Common.ps1";
private readonly string _AzureSqltestModule = $"ScenarioTests/{PsBackupProviderTypes.AzureSql}/ContainerTests.ps1";

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

[Fact(Skip = "This workload is not supported anymore")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureSql)]
public void TestAzureSqlGetContainers()
{
TestController.NewInstance.RunPsTest(
_logger, PsBackupProviderTypes.AzureSql, "Test-AzureSqlGetContainers");
TestRunner.RunTestScript(
$"Import-Module {_AzureSqlcommonModule.AsAbsoluteLocation()}",
$"Import-Module {_AzureSqltestModule.AsAbsoluteLocation()}",
"Test-AzureSqlGetContainers"
);
}

[Fact(Skip = "This workload is not supported anymore")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureSql)]
public void TestAzureSqlUnregisterContainer()
{
TestController.NewInstance.RunPsTest(
_logger, PsBackupProviderTypes.AzureSql, "Test-AzureSqlUnregisterContainer");
TestRunner.RunTestScript(
$"Import-Module {_AzureSqlcommonModule.AsAbsoluteLocation()}",
$"Import-Module {_AzureSqltestModule.AsAbsoluteLocation()}",
"Test-AzureSqlUnregisterContainer"
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,55 @@
// ----------------------------------------------------------------------------------

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

namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests
{
public partial class ItemTests : RMTestBase
public partial class ItemTests : RecoveryServicesBackupTestRunner
{
public XunitTracingInterceptor _logger;
private readonly string _AzureSqlcommonModule = $"ScenarioTests/Common.ps1";
private readonly string _AzureSqltestModule = $"ScenarioTests/{PsBackupProviderTypes.AzureSql}/ItemTests.ps1";

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

[Fact(Skip = "This workload is not supported anymore")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureSql)]
public void TestAzureSqlGetItems()
{
TestController.NewInstance.RunPsTest(
_logger, PsBackupProviderTypes.AzureSql, "Test-AzureSqlGetItems");
TestRunner.RunTestScript(
$"Import-Module {_AzureSqlcommonModule.AsAbsoluteLocation()}",
$"Import-Module {_AzureSqltestModule.AsAbsoluteLocation()}",
"Test-AzureSqlGetItems"
);
}

[Fact(Skip = "This workload is not supported anymore")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureSql)]
public void TestAzureSqlDisableProtection()
{
TestController.NewInstance.RunPsTest(
_logger, PsBackupProviderTypes.AzureSql, "Test-AzureSqlDisableProtection");
TestRunner.RunTestScript(
$"Import-Module {_AzureSqlcommonModule.AsAbsoluteLocation()}",
$"Import-Module {_AzureSqltestModule.AsAbsoluteLocation()}",
"Test-AzureSqlDisableProtection"
);
}

[Fact(Skip = "This workload is not supported anymore")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureSql)]
public void TestAzureSqlGetRPs()
{
TestController.NewInstance.RunPsTest(
_logger, PsBackupProviderTypes.AzureSql, "Test-AzureSqlGetRPs");
TestRunner.RunTestScript(
$"Import-Module {_AzureSqlcommonModule.AsAbsoluteLocation()}",
$"Import-Module {_AzureSqltestModule.AsAbsoluteLocation()}",
"Test-AzureSqlGetRPs"
);
}
}
}
Loading