Skip to content

Commit 42c6199

Browse files
committed
Merge pull request #64 from AsrOneSdk/sriramvu-dev
updated Wait for CanFailOver state logic
2 parents 90d2924 + 6a932a7 commit 42c6199

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTests.ps1

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ function Test-EnableProtection
11601160
# Validate_EnableProtection_WaitForCanFailover
11611161
if ($Validate_EnableProtection_WaitForCanFailover -eq $true)
11621162
{
1163-
WaitForCanFailover $protectionEntity.ProtectionContainerId $protectionEntity.ID
1163+
WaitForCanFailover $protectionEntity.ProtectionContainerId $protectionEntity.ID 600
11641164
}
11651165

11661166
return;
@@ -1226,21 +1226,24 @@ function Test-DisableProtection
12261226

12271227
<#
12281228
.SYNOPSIS
1229-
Recovery Services Enable Protection Tests
1229+
Wait for CanFailover state
1230+
Usage:
1231+
WaitForCanFailover pcId peId
1232+
WaitForCanFailover pcId peId secondsToWait
12301233
#>
12311234
function WaitForCanFailover
12321235
{
1233-
param([string] $pcId, [string] $peId)
1234-
$count = 20
1236+
param([string] $pcId, [string] $peId, [Int] $NumOfSecondsToWait = 120)
1237+
1238+
$timeElapse = 0;
1239+
$interval = 5;
12351240
do
12361241
{
1237-
Start-Sleep 5
1242+
Start-Sleep $interval
1243+
$timeElapse = $timeElapse + $interval
12381244
$pes = Get-AzureSiteRecoveryProtectionEntity -ProtectionContainerId $pcId;
12391245

1240-
$count = $count -1;
1241-
1242-
Assert-True { $count -gt 0 } "Job did not reached desired state within 5*$count seconds."
1243-
1246+
Assert-True { $timeElapse -lt $NumOfSecondsToWait } "Job did not reached desired state within $NumOfSecondsToWait seconds."
12441247
} while(-not ($pes[0].CanFailover -eq $true))
12451248
}
12461249

0 commit comments

Comments
 (0)