Skip to content

Commit 62a87ae

Browse files
committed
Clean up sleep in tests
1 parent adbef30 commit 62a87ae

File tree

2 files changed

+42
-11
lines changed

2 files changed

+42
-11
lines changed

src/ResourceManager/NotificationHubs/Commands.NotificationHubs.Test/ScenarioTests/NotificationHubServiceTests.ps1

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ function Test-CRUDNamespace
5959
Write-Debug "NamespaceName : $namespaceName"
6060
$result = New-AzureRmNotificationHubsNamespace -ResourceGroup $resourceGroupName -Namespace $namespaceName -Location $location
6161

62-
Start-Sleep -Seconds 15
63-
62+
if($env:AZURE_TEST_MODE -ne "Playback")
63+
{
64+
Start-Sleep -Seconds 15
65+
}
66+
6467
Write-Debug "Get the created namespace within the resource group"
6568
$createdNamespace = Get-AzureRmNotificationHubsNamespace -ResourceGroup $resourceGroupName -Namespace $namespaceName
6669
Assert-True {$createdNamespace.Count -eq 1}
@@ -90,7 +93,10 @@ function Test-CRUDNamespace
9093
Write-Debug "Namespace name : $namespaceName2"
9194
$result = New-AzureRmNotificationHubsNamespace -ResourceGroup $secondResourceGroup -Namespace $namespaceName2 -Location $location
9295

93-
Start-Sleep -Seconds 15
96+
if($env:AZURE_TEST_MODE -ne "Playback")
97+
{
98+
Start-Sleep -Seconds 15
99+
}
94100

95101
Write-Debug "Get all the namespaces created in the resourceGroup"
96102
$allCreatedNamespace = Get-AzureRmNotificationHubsNamespace -ResourceGroup $secondResourceGroup
@@ -145,7 +151,10 @@ function Test-CRUDNamespace
145151
$updatedNamespace = Set-AzureRmNotificationHubsNamespace -ResourceGroup $secondResourceGroup -Namespace $namespaceName2 -Location $location -Tags $tags
146152
Assert-AreEqual 2 $updatedNamespace.Tags.Count
147153

148-
Start-Sleep -Seconds 15
154+
if($env:AZURE_TEST_MODE -ne "Playback")
155+
{
156+
Start-Sleep -Seconds 15
157+
}
149158

150159
Write-Debug " Get the updated namespace "
151160
$getUpdatedNamespace = Get-AzureRmNotificationHubsNamespace -ResourceGroup $secondResourceGroup -Namespace $namespaceName2
@@ -181,7 +190,10 @@ function Test-CRUDNamespaceAuth
181190

182191
$result = New-AzureRmNotificationHubsNamespace -ResourceGroup $resourceGroupName -Namespace $namespaceName -Location $location
183192

184-
Start-Sleep -Seconds 15
193+
if($env:AZURE_TEST_MODE -ne "Playback")
194+
{
195+
Start-Sleep -Seconds 15
196+
}
185197

186198
Write-Debug " Get the created namespace within the resource group"
187199
$createdNamespace = Get-AzureRmNotificationHubsNamespace -ResourceGroup $resourceGroupName -Namespace $namespaceName
@@ -282,7 +294,10 @@ function Test-CRUDNamespaceAuth
282294
Assert-AreEqual $newPrimaryKey $updatedAuthRule.PrimaryKey
283295
Assert-NotNull $updatedAuthRule.SecondaryKey
284296

285-
Start-Sleep -Seconds 15
297+
if($env:AZURE_TEST_MODE -ne "Playback")
298+
{
299+
Start-Sleep -Seconds 15
300+
}
286301

287302
Write-Debug "Get updated Namespace AuthorizationRules"
288303
$updatedAuthRule = Get-AzureRmNotificationHubsNamespaceAuthorizationRules -ResourceGroup $resourceGroupName -Namespace $namespaceName -AuthorizationRule $authRuleName
@@ -332,7 +347,10 @@ function Test-CRUDNotificationHub
332347
Write-Debug " Namespace name : $namespaceName"
333348
$result = New-AzureRmNotificationHubsNamespace -ResourceGroup $resourceGroupName -Namespace $namespaceName -Location $location
334349

335-
Start-Sleep -Seconds 15
350+
if($env:AZURE_TEST_MODE -ne "Playback")
351+
{
352+
Start-Sleep -Seconds 15
353+
}
336354

337355
Write-Debug " Get the created namespace within the resource group"
338356
$createdNamespace = Get-AzureRmNotificationHubsNamespace -ResourceGroup $resourceGroupName -Namespace $namespaceName
@@ -408,7 +426,10 @@ function Test-CRUDNotificationHub
408426
$createdNotificationHub.WnsCredential.Properties.WindowsLiveEndpoint = "http://pushtestservice.cloudapp.net/LiveID/accesstoken.srf"
409427
$result = Set-AzureRmNotificationHub -ResourceGroup $resourceGroupName -Namespace $namespaceName -NotificationHubObj $createdNotificationHub
410428

411-
Start-Sleep -Seconds 15
429+
if($env:AZURE_TEST_MODE -ne "Playback")
430+
{
431+
Start-Sleep -Seconds 15
432+
}
412433

413434
Write-Debug " Get the PNS credentials for the first notificationHub created"
414435
$pnsCredentials = Get-AzureRmNotificationHubPNSCredentials -ResourceGroup $resourceGroupName -Namespace $namespaceName -NotificationHub $notificationHubName
@@ -447,7 +468,10 @@ function Test-CRUDNHAuth
447468
Write-Debug "Namespace name : $namespaceName"
448469
$result = New-AzureRmNotificationHubsNamespace -ResourceGroup $resourceGroupName -Namespace $namespaceName -Location $location
449470

450-
Start-Sleep -Seconds 15
471+
if($env:AZURE_TEST_MODE -ne "Playback")
472+
{
473+
Start-Sleep -Seconds 15
474+
}
451475

452476
Write-Debug " Get the created namespace within the resource group"
453477
$createdNamespace = Get-AzureRmNotificationHubsNamespace -ResourceGroup $resourceGroupName -Namespace $namespaceName
@@ -485,7 +509,10 @@ function Test-CRUDNHAuth
485509
Assert-True { $result.Rights -Contains "Listen" }
486510
Assert-True { $result.Rights -Contains "Send" }
487511

488-
Start-Sleep -Seconds 15
512+
if($env:AZURE_TEST_MODE -ne "Playback")
513+
{
514+
Start-Sleep -Seconds 15
515+
}
489516

490517
Write-Debug "Get created authorizationRule"
491518
$createdAuthRule = Get-AzureRmNotificationHubAuthorizationRules -ResourceGroup $resourceGroupName -Namespace $namespaceName -NotificationHub $notificationHubName -AuthorizationRule $authRuleName
@@ -533,7 +560,10 @@ function Test-CRUDNHAuth
533560
Assert-AreEqual $newPrimaryKey $updatedAuthRule.PrimaryKey
534561
Assert-NotNull $updatedAuthRule.SecondaryKey
535562

536-
Start-Sleep -Seconds 15
563+
if($env:AZURE_TEST_MODE -ne "Playback")
564+
{
565+
Start-Sleep -Seconds 15
566+
}
537567

538568
$updatedAuthRule = Get-AzureRmNotificationHubAuthorizationRules -ResourceGroup $resourceGroupName -Namespace $namespaceName -NotificationHub $notificationHubName -AuthorizationRule $authRuleName
539569

src/ResourceManager/NotificationHubs/Commands.NotificationHubs/Commands.NotificationHubs.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
<ItemGroup>
141141
<None Include="..\AzureRM.NotificationHubs.psd1">
142142
<Link>AzureRM.NotificationHubs.psd1</Link>
143+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
143144
</None>
144145
<None Include="Microsoft.Azure.Commands.NotificationHubs.dll-help.pshproj" />
145146
<None Include="packages.config">

0 commit comments

Comments
 (0)