Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vidyadharijami committed Sep 22, 2024
1 parent bbf1cc8 commit dc5299f
Show file tree
Hide file tree
Showing 3 changed files with 4,586 additions and 1,055 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -927,10 +927,26 @@ function Test-CreateRPIWithMangedDisksForReplication
param([string] $vaultSettingsFilePath)

Import-AzRecoveryServicesAsrVaultSettingsFile -Path $vaultSettingsFilePath
$PrimaryFabricName = "ToPowershell"
$fabric = Get-AsrFabric -FriendlyName $PrimaryFabricName
$pc = Get-ASRProtectionContainer -Fabric $fabric
$ProtectionContainerMapping = Get-ASRProtectionContainerMapping -ProtectionContainer $pc
$policy = Get-AzRecoveryServicesAsrPolicy -Name $PolicyName
$VM= Get-AsrProtectableItem -ProtectionContainer $pc -FriendlyName $VMName
$EnableDRjob = New-AzRecoveryServicesAsrReplicationProtectedItem -ProtectableItem $VM -Name $VM.Name -ProtectionContainerMapping $ProtectionContainerMapping[0] -RecoveryAzureStorageAccountId $StorageAccountID -OSDiskName $VMName -OS Windows -RecoveryResourceGroupId $RecoveryResourceGroupId -UseManagedDisksForReplication True

Assert-ThrowsContains { New-AzRecoveryServicesAsrReplicationProtectedItem `
-ProtectableItem $VM[0] `
-Name $VM[0].Name `
-ProtectionContainerMapping $ProtectionContainerMapping[0] `
-RecoveryAzureStorageAccountId $StorageAccountID `
-OSDiskName $VMName `
-OS Windows `
-RecoveryResourceGroupId $RecoveryResourceGroupId `
-UseManagedDisksForReplication True } `
"Only one of the input parameters are expected not both either RecoveryAzureStorageAccountId or UseManagedDisksForReplication"

$EnableDRjob = New-AzRecoveryServicesAsrReplicationProtectedItem -ProtectableItem $VM[0] -Name $VM[0].Name -ProtectionContainerMapping $ProtectionContainerMapping[0] -LogStorageAccountId $StorageAccountID -OSDiskName $VMName -OS Windows -RecoveryResourceGroupId $RecoveryResourceGroupId -UseManagedDisksForReplication True
WaitForJobCompletion -JobId $EnableDRjob.Name
$Job = Get-AzRecoveryServicesAsrJob -Name $EnableDRjob.Name
Assert-True { $Job.State -eq "Succeeded" }
}
Loading

0 comments on commit dc5299f

Please sign in to comment.