-
Notifications
You must be signed in to change notification settings - Fork 4
/
Connector.Arm.Tests.ps1
48 lines (40 loc) · 1.54 KB
/
Connector.Arm.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
48
#
# This tests whether the ARM template for Logic App API Connector 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 "Deployment Tests for Logic App API Connection for ARM" {
# 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 API connector deployed with parameters" {
$output = az group deployment validate `
-g $ResourceGroupName `
--template-file $SrcDirectory\Connector.Arm.json `
--parameters `@$SrcDirectory\Connector.Arm.parameters.json `
--parameters servicePrincipalClientSecret="abcde" `
| ConvertFrom-Json
$result = $output.properties
It "Should be deployed successfully" {
$result.provisioningState | Should -Be "Succeeded"
}
It "Should be the location of" {
$expected = (az group show -g $ResourceGroupName | ConvertFrom-Json).location
$resource = $result.validatedResources[0]
$resource.location | Should -Be $expected
}
}
}