Skip to content

Commit 31111f4

Browse files
committed
Merge pull request #393 from Azure/dev
.
2 parents 02c0288 + a37b4e9 commit 31111f4

File tree

5 files changed

+665
-0
lines changed

5 files changed

+665
-0
lines changed

src/ResourceManager/LogicApp/Commands.LogicApp.Test/Commands.LogicApp.Test.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@
160160
<None Include="Resources\TestSimpleWorkflowTriggerDefinition.json">
161161
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
162162
</None>
163+
<None Include="Resources\TestSimpleWorkflowTriggerDefinitionWithDelayAction.json">
164+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
165+
</None>
163166
<None Include="ScenarioTests\Common.ps1">
164167
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
165168
</None>
@@ -190,6 +193,9 @@
190193
<None Include="SessionRecords\Microsoft.Azure.Commands.LogicApp.Test.ScenarioTests.WorkflowRunTests\TestRunLogicApp.json">
191194
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
192195
</None>
196+
<None Include="SessionRecords\Microsoft.Azure.Commands.LogicApp.Test.ScenarioTests.WorkflowRunTests\TestStopAzureRmLogicAppRun.json">
197+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
198+
</None>
193199
<None Include="SessionRecords\Microsoft.Azure.Commands.LogicApp.Test.ScenarioTests.WorkflowTests\TestCreateAndGetLogicAppUsingDefinitionWithActions.json">
194200
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
195201
</None>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"$schema": "http://schema.management.azure.com/providers/Microsoft.Logic/schemas/2014-12-01-preview/workflowdefinition.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"runworkflowmanually": {
6+
"defaultValue": false,
7+
"type": "bool"
8+
}
9+
},
10+
"triggers": {
11+
"httpTrigger": {
12+
"type": "Http",
13+
"inputs": {
14+
"method": "GET",
15+
"uri": "http://www.bing.com"
16+
},
17+
"recurrence": {
18+
"frequency": "Hour",
19+
"interval": 1
20+
},
21+
"conditions": [
22+
{
23+
"expression": "@bool('true')"
24+
}
25+
]
26+
}
27+
},
28+
"actions": {
29+
"http": {
30+
"until": {
31+
"limit": {
32+
"timeout": "PT1H"
33+
},
34+
"conditions": [
35+
{
36+
"expression": "@bool('false')"
37+
}
38+
]
39+
},
40+
"type": "Http",
41+
"inputs": {
42+
"method": "GET",
43+
"uri": "http://www.bing.com",
44+
},
45+
"conditions": [
46+
{
47+
"expression": "@bool('true')"
48+
}
49+
]
50+
}
51+
},
52+
"outputs": {
53+
"output1": {
54+
"type": "string",
55+
"value": "true"
56+
}
57+
}
58+
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,15 @@ public void TestGetAzureLogicAppRunAction()
5252
{
5353
WorkflowController.NewInstance.RunPowerShellTest("Test-GetAzureLogicAppRunAction");
5454
}
55+
56+
/// <summary>
57+
/// Test Stop-AzureRmLogicAppRun command to cancel logic app run
58+
/// </summary>
59+
[Fact]
60+
[Trait(Category.AcceptanceType, Category.CheckIn)]
61+
public void TestStopAzureRmLogicAppRun()
62+
{
63+
WorkflowController.NewInstance.RunPowerShellTest("Test-StopAzureRmLogicAppRun");
64+
}
5565
}
5666
}

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,34 @@ function Test-GetAzureLogicAppRunAction
101101

102102
$action = Get-AzureRmLogicAppRunAction -ResourceGroupName $resourceGroupName -Name $workflowName -RunName $runHistory[0].Name -ActionName "http"
103103
Assert-NotNull $action
104+
}
105+
106+
<#
107+
.SYNOPSIS
108+
Test Start and Stop AzureLogicApp command for logic app workflow.
109+
#>
110+
function Test-StopAzureRmLogicAppRun
111+
{
112+
$resourceGroup = TestSetup-CreateResourceGroup
113+
$resourceGroupName = $resourceGroup.ResourceGroupName
114+
$planName = "StandardServicePlan"
115+
$Plan = TestSetup-CreateAppServicePlan $resourceGroup.ResourceGroupName $planName
116+
117+
$workflowName = getAssetname
118+
$definitionFilePath = "Resources\TestSimpleWorkflowTriggerDefinitionWithDelayAction.json"
119+
120+
$workflow = New-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName -DefinitionFilePath $definitionFilePath -AppServicePlan $planName
121+
122+
[int]$counter = 0
123+
do {
124+
Sleep -seconds 2
125+
$workflow = Get-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName
126+
} while ($workflow.State -ne "Enabled" -and $counter++ -lt 5)
127+
128+
Start-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName -TriggerName "httpTrigger"
129+
130+
$runHistory = Get-AzureRmLogicAppRunHistory -ResourceGroupName $resourceGroupName -Name $workflowName
131+
132+
Stop-AzureRmLogicAppRun -ResourceGroupName $resourceGroupName -Name $workflowName -RunName $runHistory[0].Name
104133

105134
}

0 commit comments

Comments
 (0)