forked from aliencube/ARM-Deployment-History-Cleaner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogicApp.Tests.ps1
47 lines (39 loc) · 1.37 KB
/
LogicApp.Tests.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#
# This tests whether the ARM template for Logic App has been properly deployed or not.
#
Param(
[string] [Parameter(Mandatory=$true)] $ResourceGroupName,
[string] [Parameter(Mandatory=$true)] $SrcDirectory,
[string] [Parameter(Mandatory=$true)] $Username,
[string] [Parameter(Mandatory=$true)] $Password,
[string] [Parameter(Mandatory=$true)] $TenantId,
[bool] [Parameter(Mandatory=$false)] $IsLocal = $false
)
Describe "Logic App Deployment Tests" {
# Init
BeforeAll {
if ($IsLocal -eq $false) {
az login --service-principal -u $Username -p $Password -t $TenantId
}
}
# Teardown
AfterAll {
}
# Tests whether the cmdlet returns value or not.
Context "When Logic App deployed with parameters" {
$output = az group deployment validate `
-g $ResourceGroupName `
--template-file $SrcDirectory\LogicApp.json `
--parameters `@$SrcDirectory\LogicApp.parameters.json `
| ConvertFrom-Json
$result = $output.properties
It "Should be deployed successfully" {
$result.provisioningState | Should -Be "Succeeded"
}
It "Should have state of" {
$expected = "Enabled"
$resource = $result.validatedResources[0]
$resource.properties.state | Should -Be $expected
}
}
}