This repository has been archived by the owner on Feb 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathintegration_test_template.config.ps1
84 lines (76 loc) · 2.95 KB
/
integration_test_template.config.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<#
.SYNOPSIS
DSC Configuration Template for DSC Resource Integration tests.
.DESCRIPTION
To Use:
1. Copy to \Tests\Integration\ folder and rename <ResourceName>.config.ps1
(e.g. MSFT_Firewall.config.ps1).
2. Customize TODO sections.
3. Remove TODO comments and TODO comment-blocks.
4. Remove this comment-based help.
.NOTES
Comment in HEADER region are standard and should not be altered.
#>
#region HEADER
# Integration Test Config Template Version: 1.2.1
#endregion
$configFile = [System.IO.Path]::ChangeExtension($MyInvocation.MyCommand.Path, 'json')
if (Test-Path -Path $configFile)
{
<#
TODO: Allows reading the configuration data from a JSON file,
e.g. integration_template.config.json for real testing
scenarios outside of the CI.
#>
$ConfigurationData = Get-Content -Path $configFile | ConvertFrom-Json
}
else
{
<#
TODO: (Optional) If appropriate, this configuration hash table
can be moved from here and into the integration test file.
For example, if there are several configurations which all
need different configuration properties, it might be easier
to have one ConfigurationData-block per configuration test
than one big ConfigurationData-block here.
It may also be moved if it is easier to read the tests when
the ConfigurationData-block is in the integration test file.
The reason for it being here is that it is easier to read
the configuration when the ConfigurationData-block is in this
file.
#>
$ConfigurationData = @{
AllNodes = @(
@{
NodeName = 'localhost'
CertificateFile = $env:DscPublicCertificatePath
# TODO: (Optional) Add configuration properties.
UserName = 'MyInstallAccount'
Password = 'MyP@ssw0rd!1'
}
)
}
}
<#
.SYNOPSIS
TODO: Add a short but clear description of what this configuration does.
(e.g. Enables the TCP port for Remote Desktop Connection on the profile Public.)
#>
# TODO: Modify ResourceName and ShortDescriptiveName (e.g. MSFT_Firewall_EnableRemoteDesktopConnection_Config).
Configuration MSFT_<ResourceName>_<ShortDescriptiveName>_Config
{
# TODO: Modify ModuleName (e.g. NetworkingDsc)
Import-DscResource -ModuleName '<ModuleName>'
node $AllNodes.NodeName
{
# TODO: Modify ResourceFriendlyName (e.g. Firewall).
<ResourceFriendlyName> 'Integration_Test'
{
# TODO: Add resource parameters here.
PsDscRunAsCredential = New-Object `
-TypeName System.Management.Automation.PSCredential `
-ArgumentList @($Node.Username, (ConvertTo-SecureString -String $Node.Password -AsPlainText -Force))
}
}
}
# TODO: (Optional) Add More Configuration Templates as needed.