Skip to content

Commit

Permalink
Merge pull request Azure#1797 from pankajsn/dev
Browse files Browse the repository at this point in the history
[Azure Logic App PS Cmdlet ] : Test Case Optimization
  • Loading branch information
Hovsep committed Feb 10, 2016
2 parents a37b4e9 + 2fa8a44 commit 82440b7
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 872 deletions.
Original file line number Diff line number Diff line change
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
}
}
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 82440b7

Please sign in to comment.