@@ -187,6 +187,37 @@ function WaitForClusterReadyState($clusterName, $resourceGroupName, $timeoutInSe
187
187
return $false
188
188
}
189
189
190
+ function WaitForManagedClusterReadyStateIfRecord ($clusterName , $resourceGroupName )
191
+ {
192
+ if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer ]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode ]::Playback)
193
+ {
194
+ # Wait for Ready cluster state before updating otherwise update is going to fail
195
+ if (-not (WaitForManagedClusterReadyState $clusterName $resourceGroupName ))
196
+ {
197
+ Assert-True $false ' Cluster is not in Ready state. Can not continue with test.'
198
+ }
199
+ }
200
+ }
201
+
202
+ function WaitForManagedClusterReadyState ($clusterName , $resourceGroupName , $timeoutInSeconds = 1200 )
203
+ {
204
+ $timeoutTime = (Get-Date ).AddSeconds($timeoutInSeconds )
205
+ while (-not $clusterReady -and (Get-Date ) -lt $timeoutTime ) {
206
+ $cluster = (Get-AzServiceFabricManagedCluster - ResourceGroupName $resourceGroupName - Name $clusterName )[0 ]
207
+ if ($cluster.ClusterState -eq " Ready" )
208
+ {
209
+ return $true
210
+ break
211
+ }
212
+
213
+ Write-Host " Cluster state: $ ( $cluster.ClusterState ) . Waiting for Ready state before continuing."
214
+ Start-Sleep - Seconds 15
215
+ }
216
+
217
+ Write-Error " WaitForClusterReadyState timed out"
218
+ return $false
219
+ }
220
+
190
221
function WaitForAllJob ($timeoutInSeconds = 1200 )
191
222
{
192
223
$timeoutTime = (Get-Date ).AddSeconds($timeoutInSeconds )
@@ -214,6 +245,53 @@ function WaitForAllJob($timeoutInSeconds = 1200)
214
245
return $false
215
246
}
216
247
248
+ <#
249
+ . SYNOPSIS
250
+ Asserts if two hashtables with simple key and value types are equal
251
+ #>
252
+ function Assert-HashtableEqual ($h1 , $h2 )
253
+ {
254
+ if ($h1.count -ne $h2.count )
255
+ {
256
+ throw " Hashtable size not equal. Hashtable1: " + $h1.count + " Hashtable2: " + $h2.count
257
+ }
258
+
259
+ foreach ($key in $h1.Keys )
260
+ {
261
+ if ($h1 [$key ] -ne $h2 [$key ])
262
+ {
263
+ throw " Tag content not equal. Key:$key Tags1:" + $h1 [$key ] + " Tags2:" + $h2 [$key ]
264
+ }
265
+ }
266
+ }
267
+
268
+ # ##################
269
+ #
270
+ # Verify that the actual string ends with the expected suffix
271
+ #
272
+ # param [string] $expectedSuffix : The expected suffix
273
+ # param [string] $actual : The actual string
274
+ # param [string] $message : The message to return if the actual string does not end with the suffix
275
+ # ###################
276
+ function Assert-EndsWith
277
+ {
278
+ param ([string ] $expectedSuffix , [string ] $actual , [string ] $message )
279
+
280
+ Assert-NotNull $actual
281
+
282
+ if (! $message )
283
+ {
284
+ $message = " Assertion failed because actual '$actual ' does not end with '$expectedSuffix '"
285
+ }
286
+
287
+ if (-not $actual.EndsWith ($expectedSuffix ))
288
+ {
289
+ throw $message
290
+ }
291
+
292
+ return $true
293
+ }
294
+
217
295
# Application functions
218
296
219
297
function Get-AppTypeName
@@ -244,4 +322,41 @@ function Get-AppPackageV2
244
322
function Get-ServiceTypeName
245
323
{
246
324
return " CalcServiceType"
325
+ }
326
+
327
+ # Managed Application functions
328
+
329
+ function Get-ManagedAppTypeName
330
+ {
331
+ return " VotingType"
332
+ }
333
+
334
+ function Get-ManagedAppTypeV1Name
335
+ {
336
+ return " 1.0.0"
337
+ }
338
+
339
+ function Get-ManagedAppTypeV2Name
340
+ {
341
+ return " 2.0.0"
342
+ }
343
+
344
+ function Get-ManagedAppPackageV1
345
+ {
346
+ return " https://sfmconeboxst.blob.core.windows.net/managed-application-deployment/Voting.sfpkg"
347
+ }
348
+
349
+ function Get-ManagedAppPackageV2
350
+ {
351
+ return " https://sfmconeboxst.blob.core.windows.net/managed-application-deployment/Voting.2.0.0.sfpkg"
352
+ }
353
+
354
+ function Get-ManagedStatelessServiceTypeName
355
+ {
356
+ return " VotingWebType"
357
+ }
358
+
359
+ function Get-ManagedStatefulServiceTypeName
360
+ {
361
+ return " VotingDataType"
247
362
}
0 commit comments