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