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 2 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 @@ -15,28 +15,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 _commonModule = $"ScenarioTests/{PsBackupProviderTypes.AzureFiles}/Common.ps1";
private readonly string _testModule = $"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 {_commonModule.AsAbsoluteLocation()}",
$"Import-Module {_testModule.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 {_commonModule.AsAbsoluteLocation()}",
$"Import-Module {_testModule.AsAbsoluteLocation()}",
"Test-AzureFSUnregisterContainer"
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,55 +15,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 _commonModule = $"ScenarioTests/{PsBackupProviderTypes.AzureFiles}/Common.ps1";
private readonly string _testModule = $"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 {_commonModule.AsAbsoluteLocation()}",
$"Import-Module {_testModule.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 {_commonModule.AsAbsoluteLocation()}",
$"Import-Module {_testModule.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 {_commonModule.AsAbsoluteLocation()}",
$"Import-Module {_testModule.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 {_commonModule.AsAbsoluteLocation()}",
$"Import-Module {_testModule.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 {_commonModule.AsAbsoluteLocation()}",
$"Import-Module {_testModule.AsAbsoluteLocation()}",
"Test-AzureFSFullRestore"
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,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 _commonModule = $"ScenarioTests/{PsBackupProviderTypes.AzureFiles}/Common.ps1";
private readonly string _testModule = $"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 {_commonModule.AsAbsoluteLocation()}",
$"Import-Module {_testModule.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 {_commonModule.AsAbsoluteLocation()}",
$"Import-Module {_testModule.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 {_commonModule.AsAbsoluteLocation()}",
$"Import-Module {_testModule.AsAbsoluteLocation()}",
"Test-AzureFSWaitJob"
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,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 _commonModule = $"ScenarioTests/{PsBackupProviderTypes.AzureFiles}/Common.ps1";
private readonly string _testModule = $"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 {_commonModule.AsAbsoluteLocation()}",
$"Import-Module {_testModule.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 {_commonModule.AsAbsoluteLocation()}",
$"Import-Module {_testModule.AsAbsoluteLocation()}",
"Test-AzureFSHourlyPolicy"
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,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 _commonModule = $"ScenarioTests/{PsBackupProviderTypes.AzureFiles}/Common.ps1";
private readonly string _testModule = $"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 {_commonModule.AsAbsoluteLocation()}",
$"Import-Module {_testModule.AsAbsoluteLocation()}",
"Test-AzureFSProtectionCheck"
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,44 @@
// ----------------------------------------------------------------------------------

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 _commonModule1 = $"ScenarioTests/Common.ps1";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DO NOT name with meaningless numbers. You can call it _containerCommModule.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some names of these files are duplicate, so I update them to folder name. Thanks.

private readonly string _testModule1 = $"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 {_commonModule1.AsAbsoluteLocation()}",
$"Import-Module {_testModule1.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 {_commonModule1.AsAbsoluteLocation()}",
$"Import-Module {_testModule1.AsAbsoluteLocation()}",
"Test-AzureSqlUnregisterContainer"
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,56 @@
// ----------------------------------------------------------------------------------

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 _commonModule1 = $"ScenarioTests/Common.ps1";
private readonly string _testModule1 = $"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 {_commonModule1.AsAbsoluteLocation()}",
$"Import-Module {_testModule1.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 {_commonModule1.AsAbsoluteLocation()}",
$"Import-Module {_testModule1.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 {_commonModule1.AsAbsoluteLocation()}",
$"Import-Module {_testModule1.AsAbsoluteLocation()}",
"Test-AzureSqlGetRPs"
);
}
}
}
Loading