Skip to content

Commit 2fa8a44

Browse files
committed
Test case optimization
1 parent 24836b9 commit 2fa8a44

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

src/ResourceManager/LogicApp/Commands.LogicApp.Test/ScenarioTests/Common.ps1

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,17 @@ function TestSetup-CreateWorkflow ([string]$resourceGroupName, [string]$workflow
106106
$parameterFilePath = "Resources\TestSimpleWorkflowParameter.json"
107107
$workflow = $resourceGroup | New-AzureRmLogicApp -Name $workflowName -AppServicePlan $AppServicePlan -DefinitionFilePath $definitionFilePath -ParameterFilePath $parameterFilePath
108108
return $workflow
109+
}
110+
111+
<#
112+
.SYNOPSIS
113+
Sleep in record mode only
114+
#>
115+
function SleepInRecordMode ([int]$SleepIntervalInMillisec)
116+
{
117+
$mode = $env:AZURE_TEST_MODE
118+
if ( $mode.ToUpperInvariant() -eq "RECORD")
119+
{
120+
Sleep -Milliseconds $SleepIntervalInMillisec
121+
}
109122
}

src/ResourceManager/LogicApp/Commands.LogicApp.Test/ScenarioTests/WorkflowRunTests.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function Test-StartLogicApp
3030

3131
[int]$counter = 0
3232
do {
33-
Sleep -seconds 2
33+
SleepInRecordMode 2000
3434
$workflow = Get-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName
3535
} while ($workflow.State -ne "Enabled" -and $counter++ -lt 5)
3636

@@ -55,7 +55,7 @@ function Test-GetAzureLogicAppRunHistory
5555

5656
[int]$counter = 0
5757
do {
58-
Sleep -seconds 2
58+
SleepInRecordMode 2000
5959
$workflow = Get-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName
6060
} while ($workflow.State -ne "Enabled" -and $counter++ -lt 5)
6161

@@ -86,7 +86,7 @@ function Test-GetAzureLogicAppRunAction
8686

8787
[int]$counter = 0
8888
do {
89-
Sleep -seconds 2
89+
SleepInRecordMode 2000
9090
$workflow = Get-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName
9191
} while ($workflow.State -ne "Enabled" -and $counter++ -lt 5)
9292

@@ -121,7 +121,7 @@ function Test-StopAzureRmLogicAppRun
121121

122122
[int]$counter = 0
123123
do {
124-
Sleep -seconds 2
124+
SleepInRecordMode 2000
125125
$workflow = Get-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName
126126
} while ($workflow.State -ne "Enabled" -and $counter++ -lt 5)
127127

src/ResourceManager/LogicApp/Commands.LogicApp.Test/ScenarioTests/WorkflowTriggerTests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function Test-GetAzureLogicAppTriggerHistory
5353

5454
[int]$counter = 0
5555
do {
56-
Sleep -Milliseconds 2000
56+
SleepInRecordMode 2000
5757
$workflow = Get-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName
5858
} while ($workflow.State -ne "Enabled" -and $counter++ -lt 5)
5959

@@ -85,7 +85,7 @@ function Test-StartAzureLogicAppTrigger
8585

8686
[int]$counter = 0
8787
do {
88-
Sleep -Milliseconds 2000
88+
SleepInRecordMode 2000
8989
$workflow = Get-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName
9090
} while ($workflow.State -ne "Enabled" -and $counter++ -lt 5)
9191

0 commit comments

Comments
 (0)