-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathStorageAccount.Tests.ps1
More file actions
49 lines (41 loc) · 1.57 KB
/
StorageAccount.Tests.ps1
File metadata and controls
49 lines (41 loc) · 1.57 KB
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
49
#
# This tests whether the ARM template for Storage Account 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 Storage Account deployed with parameters" {
$guid = [Guid]::NewGuid().ToString().Replace("-", "").Substring(0, 24)
$output = az group deployment validate `
-g $ResourceGroupName `
--template-file $SrcDirectory\StorageAccount.json `
--parameters `@$SrcDirectory\StorageAccount.parameters.json `
--parameters storageAccountName=$guid `
| 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
}
}
}