Skip to content

Commit 61b9e90

Browse files
committed
PS Enable-Disable Protected Item Test cases
1 parent baa08e2 commit 61b9e90

File tree

2 files changed

+40
-0
lines changed
  • src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Test/ScenarioTests/IaasVm

2 files changed

+40
-0
lines changed

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Test/ScenarioTests/IaasVm/ItemTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,19 @@ public void TestGetItemScenario()
3131
{
3232
this.RunPowerShellTest(PsBackupProviderTypes.IaasVm.ToString(), "Test-GetItemScenario");
3333
}
34+
35+
[Fact]
36+
[Trait(Category.AcceptanceType, Category.CheckIn)]
37+
public void TestEnableAzureVMProtectionScenario()
38+
{
39+
this.RunPowerShellTest(PsBackupProviderTypes.IaasVm.ToString(), "Test-EnableAzureVMProtectionScenario");
40+
}
41+
42+
[Fact]
43+
[Trait(Category.AcceptanceType, Category.CheckIn)]
44+
public void TestDisableAzureVMProtectionScenario()
45+
{
46+
this.RunPowerShellTest(PsBackupProviderTypes.IaasVm.ToString(), "Test-DisableAzureVMProtectionScenario");
47+
}
3448
}
3549
}

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Test/ScenarioTests/IaasVm/ItemTests.ps1

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,30 @@ function Test-GetItemScenario
2222

2323
$item = Get-AzureRmRecoveryServicesItem -Container $namedContainer -WorkloadType "AzureVM";
2424
echo $item.Name;
25+
}
26+
27+
function Test-EnableAzureVMProtectionScenario
28+
{
29+
$vault = Get-AzureRmRecoveryServicesVault -ResourceGroupName "phaniktRSV" -Name "phaniktRs1";
30+
Set-AzureRmRecoveryServicesVaultContext -Vault $vault;
31+
32+
$policy = Get-AzureRmRecoveryServicesProtectionPolicy -Name "pwtest1"
33+
34+
$job = Enable-AzureRmRecoveryServicesProtection -Name "mylinux1" -ResourceGroupName "mylinux1" -WorkloadType "AzureVM" -Policy $policy;
35+
Assert-AreEqual $job.Status "Completed";
36+
37+
}
38+
39+
function Test-DisableAzureVMProtectionScenario
40+
{
41+
$vault = Get-AzureRmRecoveryServicesVault -ResourceGroupName "phaniktRSV" -Name "phaniktRs1";
42+
Set-AzureRmRecoveryServicesVaultContext -Vault $vault;
43+
44+
$namedContainer = Get-AzureRmRecoveryServicesContainer -ContainerType "AzureVM" -Status "Registered" -Name "mylinux1";
45+
Assert-AreEqual $namedContainer.FriendlyName "mylinux1";
46+
47+
$item = Get-AzureRmRecoveryServicesItem -Container $namedContainer -WorkloadType "AzureVM";
48+
49+
$job = Disable-AzureRmRecoveryServicesProtection -Item $item -Force;
50+
Assert-AreEqual $job.Status "Completed";
2551
}

0 commit comments

Comments
 (0)