Skip to content

Commit fbee436

Browse files
committed
Merge pull request #126 from huangpf/dev
Dev
2 parents 1e67e6c + 37faca8 commit fbee436

File tree

5 files changed

+200
-872
lines changed

5 files changed

+200
-872
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: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ function Test-GetAzureLogicAppTriggerHistory
5353

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

6060
Start-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName -TriggerName "httpTrigger"
6161

@@ -85,20 +85,13 @@ function Test-StartAzureLogicAppTrigger
8585

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

92-
$workflowTriggerHistories1 = Get-AzureRmLogicAppTriggerHistory -ResourceGroupName $resourceGroupName -Name $workflowName -TriggerName "httpTrigger"
93-
$counter = 2
94-
while($val -lt $counter)
95-
{
96-
Start-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName -TriggerName "httpTrigger"
97-
Sleep -seconds 1
98-
$val++
99-
}
92+
Start-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName -TriggerName "httpTrigger"
10093

101-
$workflowTriggerHistories2 = Get-AzureRmLogicAppTriggerHistory -ResourceGroupName $resourceGroupName -Name $workflowName -TriggerName "httpTrigger"
102-
$count = $workflowTriggerHistories2.Count - $workflowTriggerHistories1.Count
103-
Assert-AreEqual $counter $count
94+
$workflowTriggerHistories = Get-AzureRmLogicAppTriggerHistory -ResourceGroupName $resourceGroupName -Name $workflowName -TriggerName "httpTrigger"
95+
96+
Assert-AreEqual 1 $workflowTriggerHistories.Count
10497
}

0 commit comments

Comments
 (0)