Skip to content

Commit 0a2a030

Browse files
committed
Merge pull request #273 from MabOneSdk/pragrawa-dev1
Protection Test Recordings
2 parents 53ad912 + b007610 commit 0a2a030

File tree

5 files changed

+2055
-7
lines changed

5 files changed

+2055
-7
lines changed

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Test/Commands.RecoveryServices.Backup.Test.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@
143143
<None Include="SessionRecords\Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests.ItemTests\TestBackupItemScenario.json">
144144
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
145145
</None>
146+
<None Include="SessionRecords\Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests.ItemTests\TestEnableAzureVMProtectionScenario.json">
147+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
148+
</None>
149+
<None Include="SessionRecords\Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests.ItemTests\TestDisableAzureVMProtectionScenario.json">
150+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
151+
</None>
146152
<None Include="SessionRecords\Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests.JobTests\TestCancelJobScenario.json" />
147153
<None Include="SessionRecords\Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests.JobTests\TestGetJobDetails.json">
148154
<CopyToOutputDirectory>Always</CopyToOutputDirectory>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ public void TestGetItemScenario()
3232
this.RunPowerShellTest(PsBackupProviderTypes.IaasVm.ToString(), "Test-GetItemScenario");
3333
}
3434

35+
[Fact]
36+
[Trait(Category.AcceptanceType, Category.CheckIn)]
3537
public void TestEnableAzureVMProtectionScenario()
3638
{
3739
this.RunPowerShellTest(PsBackupProviderTypes.IaasVm.ToString(), "Test-EnableAzureVMProtectionScenario");
3840
}
3941

42+
[Fact]
43+
[Trait(Category.AcceptanceType, Category.CheckIn)]
4044
public void TestDisableAzureVMProtectionScenario()
4145
{
4246
this.RunPowerShellTest(PsBackupProviderTypes.IaasVm.ToString(), "Test-DisableAzureVMProtectionScenario");

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,27 +59,32 @@ function Test-GetItemScenario
5959

6060
function Test-EnableAzureVMProtectionScenario
6161
{
62-
$vault = Get-AzureRmRecoveryServicesVault -ResourceGroupName "phaniktRSV" -Name "phaniktRs1";
62+
$vault = Get-AzureRmRecoveryServicesVault -ResourceGroupName "RsvTestRG" -Name "PsTestRsVault";
6363
Set-AzureRmRecoveryServicesVaultContext -Vault $vault;
6464

65-
$policy = Get-AzureRmRecoveryServicesBackupProtectionPolicy -Name "pwtest1"
65+
$policy = Get-AzureRmRecoveryServicesBackupProtectionPolicy -Name "DefaultPolicy";
6666

67-
$job = Enable-AzureRmRecoveryServicesBackupProtection -Name "mylinux1" -ResourceGroupName "mylinux1" -WorkloadType "AzureVM" -Policy $policy;
67+
$job = Enable-AzureRmRecoveryServicesBackupProtection -Name "mkheranirmvm1" -ResourceGroupName "mkheranirmvm1" -Policy $policy;
6868
Assert-AreEqual $job.Status "Completed";
6969

7070
}
7171

7272
function Test-DisableAzureVMProtectionScenario
7373
{
74-
$vault = Get-AzureRmRecoveryServicesVault -ResourceGroupName "phaniktRSV" -Name "phaniktRs1";
74+
$vault = Get-AzureRmRecoveryServicesVault -ResourceGroupName "RsvTestRG" -Name "PsTestRsVault";
75+
76+
# 2. Set the vault context
7577
Set-AzureRmRecoveryServicesVaultContext -Vault $vault;
7678

77-
$namedContainer = Get-AzureRmRecoveryServicesContainer -ContainerType "AzureVM" -Status "Registered" -Name "mylinux1";
78-
Assert-AreEqual $namedContainer.FriendlyName "mylinux1";
79+
# 3. Get the container
80+
$namedContainer = Get-AzureRmRecoveryServicesBackupContainer -ContainerType "AzureVM" -Status "Registered" -Name "mkheraniRMVM1";
81+
Assert-AreEqual $namedContainer.FriendlyName "mkheraniRMVM1";
7982

83+
# VAR-1: Get all items for container
8084
$item = Get-AzureRmRecoveryServicesBackupItem -Container $namedContainer -WorkloadType "AzureVM";
85+
Assert-AreEqual $item.Name "iaasvmcontainerv2;mkheranirmvm1;mkheranirmvm1";
8186

82-
$job = Disable-AzureRmRecoveryServicesBackupProtection -Item $item -Force;
87+
$job = Disable-AzureRmRecoveryServicesBackupProtection -Item $item -RemoveRecoveryPoints -Force;
8388
Assert-AreEqual $job.Status "Completed";
8489
}
8590

0 commit comments

Comments
 (0)