Skip to content

Commit

Permalink
Merge pull request Azure#397 from Azure/dev
Browse files Browse the repository at this point in the history
HPF PR: dev <- Azure:dev
  • Loading branch information
huangpf committed Feb 10, 2016
2 parents 8ae38ce + 82440b7 commit 37faca8
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 872 deletions.
Expand Up @@ -106,4 +106,17 @@ function TestSetup-CreateWorkflow ([string]$resourceGroupName, [string]$workflow
$parameterFilePath = "Resources\TestSimpleWorkflowParameter.json"
$workflow = $resourceGroup | New-AzureRmLogicApp -Name $workflowName -AppServicePlan $AppServicePlan -DefinitionFilePath $definitionFilePath -ParameterFilePath $parameterFilePath
return $workflow
}

<#
.SYNOPSIS
Sleep in record mode only
#>
function SleepInRecordMode ([int]$SleepIntervalInMillisec)
{
$mode = $env:AZURE_TEST_MODE
if ( $mode.ToUpperInvariant() -eq "RECORD")
{
Sleep -Milliseconds $SleepIntervalInMillisec
}
}
Expand Up @@ -30,7 +30,7 @@ function Test-StartLogicApp

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

Expand All @@ -55,7 +55,7 @@ function Test-GetAzureLogicAppRunHistory

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

Expand Down Expand Up @@ -86,7 +86,7 @@ function Test-GetAzureLogicAppRunAction

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

Expand Down Expand Up @@ -121,7 +121,7 @@ function Test-StopAzureRmLogicAppRun

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

Expand Down
Expand Up @@ -53,9 +53,9 @@ function Test-GetAzureLogicAppTriggerHistory

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

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

Expand Down Expand Up @@ -85,20 +85,13 @@ function Test-StartAzureLogicAppTrigger

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

$workflowTriggerHistories1 = Get-AzureRmLogicAppTriggerHistory -ResourceGroupName $resourceGroupName -Name $workflowName -TriggerName "httpTrigger"
$counter = 2
while($val -lt $counter)
{
Start-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName -TriggerName "httpTrigger"
Sleep -seconds 1
$val++
}
Start-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName -TriggerName "httpTrigger"

$workflowTriggerHistories2 = Get-AzureRmLogicAppTriggerHistory -ResourceGroupName $resourceGroupName -Name $workflowName -TriggerName "httpTrigger"
$count = $workflowTriggerHistories2.Count - $workflowTriggerHistories1.Count
Assert-AreEqual $counter $count
$workflowTriggerHistories = Get-AzureRmLogicAppTriggerHistory -ResourceGroupName $resourceGroupName -Name $workflowName -TriggerName "httpTrigger"

Assert-AreEqual 1 $workflowTriggerHistories.Count
}

0 comments on commit 37faca8

Please sign in to comment.