Skip to content

Commit

Permalink
add TestRunner and remove TestBase in RecoveryServices (#18617)
Browse files Browse the repository at this point in the history
* add TestRunner and remove TestBase in RecoveryServices

* remove zip file and add intro

* remove some meaningless numbers
  • Loading branch information
CaptainFanZzz authored Jun 21, 2022
1 parent 672fbef commit 52222a2
Show file tree
Hide file tree
Showing 36 changed files with 1,022 additions and 1,878 deletions.
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

0 comments on commit 52222a2

Please sign in to comment.