-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazuredeploy.tests.ps1
49 lines (43 loc) · 2.08 KB
/
azuredeploy.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
49
#Requires -Modules Pester
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$template = Split-Path -Leaf $here
Describe "Template: $template" -Tags Unit {
Context "Template Syntax" {
It "Has a JSON template" {
"$here\azuredeploy.json" | Should Exist
}
It "Has a parameters file" {
"$here\azuredeploy.parameters.json" | Should Exist
}
It "Has a metadata file" {
"$here\metadata.json" | Should Exist
}
It "Converts from JSON and has the expected properties" {
$expectedProperties = '$schema',
'contentVersion',
'parameters',
'variables',
'resources',
'outputs'
$templateProperties = (Get-Content "$here\azuredeploy.json" | ConvertFrom-Json -ErrorAction SilentlyContinue) | Get-Member -MemberType NoteProperty | ForEach-Object Name
$templateProperties | Should Be $expectedProperties
}
It "Creates expected Azure resources" {
$expectedResources = 'VirtualNetwork',
'DomainControllerPublicIpAddress',
'DomainControllerNetworkInterface',
'DomainControllerVirtualMachine',
'DomainControllerDscExtension',
'SqlPublicIpAddress',
'SqlNetworkInterface',
'SqlVirtualMachine',
'SqlDscExtension',
'SccmPublicIpAddress',
'SccmNetworkInterface',
'SccmVirtualMachine',
'SccmDscExtension'
$templateResources = (Get-Content "$here\azuredeploy.json" | ConvertFrom-Json -ErrorAction SilentlyContinue).Resources.name
$templateResources | Should Be $expectedResources
}
}
}