Skip to content

Commit b5ebe44

Browse files
committed
Merge branch 'dev' of https://github.com/AsrOneSdk/azure-powershell into sriramvu-dev
Conflicts: src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Properties/Resources.resx
2 parents c945715 + a44847a commit b5ebe44

12 files changed

+1276
-238
lines changed

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

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
$Validate_EnableProtection_JobSucceeded = $true;
2020
$Validate_DisableProtection_JobSucceeded = $true;
21+
2122
$Validate_PFO_JobSucceeded = $true;
2223
$Validate_Commit_PFO_JobSucceeded = $true;
2324
$Validate_Commit_Failback_JobSucceeded = $true;
@@ -33,6 +34,7 @@ $Validate_PFOFailbackRP_JobSucceeded = $true;
3334
$Validate_ProfileDissociation_JobSucceeded = $true;
3435
$Validate_ProfileAssociation_JobSucceeded = $true;
3536

37+
#Test-EnableProtection 'E:\d\E2E_SKVault_Wednesday,January28,2015.VaultCredentials'
3638

3739
<#
3840
.SYNOPSIS
@@ -79,6 +81,7 @@ function Test-E2E_DeleteAndDissociate
7981
if ($Validate_ProfileDissociation_JobSucceeded -eq $true)
8082
{
8183
WaitForJobCompletion -JobId $job.ID
84+
$job = Get-AzureSiteRecoveryJob -Id $job.ID
8285
Assert-True { $job.State -eq "Succeeded" }
8386
}
8487

@@ -90,8 +93,7 @@ function Test-E2E_DeleteAndDissociate
9093
}
9194
}
9295

93-
throw("No PC found for E2E_DeleteAndDissociate");
94-
96+
Assert-NotNull($job) "No PC found for E2E_DeleteAndDissociate"
9597
}
9698

9799

@@ -133,14 +135,15 @@ function Test-E2E_CreateAndAssociate
133135
if ($Validate_ProfileAssociation_JobSucceeded -eq $true)
134136
{
135137
WaitForJobCompletion -JobId $job.ID
138+
$job = Get-AzureSiteRecoveryJob -Id $job.ID
136139
Assert-True { $job.State -eq "Succeeded" }
137140
}
138141

139142
return;
140143
}
141144
}
142145

143-
throw("No PC found for E2E_CreateAndAssociate");
146+
Assert-NotNull($job) "No PC found for E2E_CreateAndAssociate"
144147
}
145148

146149
<#
@@ -565,7 +568,7 @@ function Test-Failback
565568
}
566569
}
567570

568-
throw("No VM found for failback");
571+
Assert-NotNull($job) "No VM found for failback"
569572
}
570573

571574

@@ -614,7 +617,7 @@ function Test-RRAfterFailback
614617
}
615618
}
616619

617-
throw("No VM found for RRAfterFailback");
620+
Assert-NotNull($job) "No VM found for RRAfterFailback";
618621
}
619622

620623

@@ -658,6 +661,12 @@ function Test-RRAfterFailover
658661
Assert-True { $job.State -eq "Succeeded" }
659662
}
660663

664+
# Validate_EnableProtection_WaitForCanFailover
665+
if ($Validate_EnableProtection_WaitForCanFailover -eq $true)
666+
{
667+
WaitForCanFailover $protectionEntity.ProtectionContainerId $protectionEntity.ID
668+
}
669+
661670
return;
662671
}
663672
}
@@ -712,7 +721,7 @@ function Test-CommitPFO
712721
}
713722
}
714723

715-
throw("No VM found for Commit_PFO");
724+
Assert-NotNull($job) "No VM found for Commit_PFO"
716725
}
717726

718727

@@ -761,7 +770,7 @@ function Test-PFO
761770
}
762771
}
763772

764-
throw("No VM found for PFO");
773+
Assert-NotNull($job) "No VM found for PFO"
765774
}
766775

767776
<#
@@ -1033,7 +1042,7 @@ function Test-UFO
10331042
}
10341043
}
10351044

1036-
throw("No VM found for UFO");
1045+
Assert-NotNull($job) "No VM found for UFO"
10371046
}
10381047

10391048

@@ -1090,7 +1099,7 @@ function Test-TFO
10901099
}
10911100
}
10921101

1093-
throw("No VM found for TFO");
1102+
Assert-NotNull($job) "No VM found for TFO"
10941103
}
10951104

10961105
<#
@@ -1124,18 +1133,20 @@ function Test-EnableProtection
11241133
if ($protectionEntity.Protected -eq $false)
11251134
{
11261135
$job = Set-AzureSiteRecoveryProtectionEntity -ProtectionEntity $protectionEntity -Protection "Enable" -Force -ProtectionProfile $protectionContainer.AvailableProtectionProfiles[0] -WaitForCompletion
1136+
Assert-NotNull($job.State)
1137+
Assert-NotNull($job.ID)
11271138

11281139
# Validate_EnableProtection_JobSucceeded
11291140
if ($Validate_EnableProtection_JobSucceeded -eq $true)
11301141
{
11311142
$job = Get-AzureSiteRecoveryJob -Id $job.ID
1132-
Assert-True { $job.State -eq "Succeeded" }
1143+
Assert-True { $job.State -eq "Succeeded" } "Job state is not not Succeeded. $job.State "
11331144
}
11341145

11351146
# Validate_EnableProtection_WaitForCanFailover
11361147
if ($Validate_EnableProtection_WaitForCanFailover -eq $true)
11371148
{
1138-
WaitForCanFailover $protectionEntity.Id
1149+
WaitForCanFailover $protectionEntity.ProtectionContainerId $protectionEntity.ID
11391150
}
11401151

11411152
return;
@@ -1144,7 +1155,7 @@ function Test-EnableProtection
11441155
}
11451156
}
11461157

1147-
throw("No VM found for Enable Protection");
1158+
Assert-NotNull($job) "No VM found for Enable Protection"
11481159
}
11491160

11501161
<#
@@ -1175,16 +1186,18 @@ function Test-DisableProtection
11751186
{
11761187
Assert-NotNull($protectionEntity.Name)
11771188
Assert-NotNull($protectionEntity.ID)
1178-
Write-Host "Checking PE"
1189+
Write-Output "Checking PE"
11791190
$protectionEntity
11801191
if ($protectionEntity.Protected -eq $true)
11811192
{
1182-
Write-Host "Disabling protection for PE: " + $protectionEntity.Name + " (" + $protectionEntity.ID + ")"
1193+
Write-Output "Disabling protection for PE: " + $protectionEntity.Name + " (" + $protectionEntity.ID + ")"
11831194
$job = Set-AzureSiteRecoveryProtectionEntity -ProtectionEntity $protectionEntity -Protection "Disable" -Force -WaitForCompletion
1184-
1195+
Assert-NotNull($job);
1196+
11851197
# Validate_DisableProtection_JobSucceeded
11861198
if ($Validate_DisableProtection_JobSucceeded -eq $true)
11871199
{
1200+
$job = Get-AzureSiteRecoveryJob -Id $job.ID
11881201
Assert-True { $job.State -eq "Succeeded" }
11891202
}
11901203

@@ -1194,7 +1207,7 @@ function Test-DisableProtection
11941207
}
11951208
}
11961209

1197-
throw("No VM found for Disable Protection");
1210+
Assert-NotNull($job) "No VM found for Disable Protection"
11981211
}
11991212

12001213
<#
@@ -1203,23 +1216,18 @@ Recovery Services Enable Protection Tests
12031216
#>
12041217
function WaitForCanFailover
12051218
{
1206-
param([string] $peId)
1219+
param([string] $pcId, [string] $peId)
12071220
$count = 20
12081221
do
12091222
{
12101223
Start-Sleep 5
1211-
$pe = Get-AzureSiteRecoveryProtectionEntity -Id peId;
1212-
if ($count -ne 0)
1213-
{
1214-
$count = $count -1;
1215-
}
1216-
else
1217-
{
1218-
throw("WaitForCanFailover failed.");
1219-
return;
1220-
}
1224+
$pes = Get-AzureSiteRecoveryProtectionEntity -ProtectionContainerId $pcId;
1225+
1226+
$count = $count -1;
1227+
1228+
Assert-True { $count -gt 0 } "Job did not reached desired state within 5*$count seconds."
12211229

1222-
} while( -not ($pe.CanFailover -eq $true))
1230+
} while(-not ($pes[0].CanFailover -eq $true))
12231231
}
12241232

12251233
<#

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServices.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@
6363
<SpecificVersion>False</SpecificVersion>
6464
<HintPath>..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
6565
</Reference>
66+
<Reference Include="Microsoft.WindowsAzure.Commands.ServiceManagement">
67+
<HintPath>..\..\..\Package\Debug\ServiceManagement\Azure\Compute\Microsoft.WindowsAzure.Commands.ServiceManagement.dll</HintPath>
68+
</Reference>
6669
<Reference Include="Microsoft.WindowsAzure.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6770
<SpecificVersion>False</SpecificVersion>
6871
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Common.1.4.0\lib\net45\Microsoft.WindowsAzure.Common.dll</HintPath>

0 commit comments

Comments
 (0)