Skip to content

Commit 57eda43

Browse files
committed
Add Pester test for ARMv2 config as emitted by Bicep
1 parent 2d179d4 commit 57eda43

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

dsc/tests/dsc_armv2.tests.ps1

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
Describe 'ARM Language 2.0 tests' {
5+
It 'config with ARM Language 2.0 format works' {
6+
<#
7+
This JSON config built from the following Bicep code using the
8+
desiredStateConfiguration and moduleExtensionConfigs experimental features:
9+
10+
extension dsc
11+
targetScope = 'desiredStateConfiguration'
12+
13+
resource echoResource 'Microsoft.DSC.Debug/Echo@1.0.0' = {
14+
output: 'Hello World'
15+
}
16+
#>
17+
$configJson = @'
18+
{
19+
"$schema": "https://aka.ms/dsc/schemas/v3/bundled/config/document.json",
20+
"languageVersion": "2.2-experimental",
21+
"contentVersion": "1.0.0.0",
22+
"metadata": {
23+
"_EXPERIMENTAL_WARNING": "This template uses ARM features that are experimental. Experimental features should be enabled for testing purposes only, as there are no guarantees about the quality or stability of these features. Do not enable these settings for any production usage, or your production environment may be subject to breaking.",
24+
"_EXPERIMENTAL_FEATURES_ENABLED": [
25+
"Enable defining extension configs for modules"
26+
],
27+
"_generator": {
28+
"name": "bicep",
29+
"version": "0.38.33.27573",
30+
"templateHash": "5233252217641859406"
31+
}
32+
},
33+
"extensions": {
34+
"dsc": {
35+
"name": "DesiredStateConfiguration",
36+
"version": "0.1.0"
37+
}
38+
},
39+
"resources": {
40+
"echoResource": {
41+
"extension": "dsc",
42+
"type": "Microsoft.DSC.Debug/Echo",
43+
"apiVersion": "1.0.0",
44+
"properties": {
45+
"output": "Hello World"
46+
}
47+
}
48+
}
49+
}
50+
'@
51+
$out = dsc config get -i $configJson | ConvertFrom-Json -Depth 10
52+
$LASTEXITCODE | Should -Be 0
53+
$out.results | Should -HaveCount 1
54+
$out.results[0].type | Should -Be 'Microsoft.DSC.Debug/Echo'
55+
$out.results[0].result.actualState.output | Should -Be 'Hello World'
56+
}
57+
}

0 commit comments

Comments
 (0)