Skip to content

Commit 5e341bb

Browse files
committed
Add test for variable
1 parent 00ae1d0 commit 5e341bb

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

dsc/tests/dsc_extension_secret.tests.ps1

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,23 @@ Describe 'Tests for the secret() function and extensions' {
144144
type: Microsoft.DSC.Debug/Echo
145145
properties:
146146
output: "[parameters('myString')]"
147+
'@
148+
$out = dsc -l trace config get -i $configYaml 2> $TestDrive/error.log | ConvertFrom-Json
149+
$LASTEXITCODE | Should -Be 0
150+
$out.results.Count | Should -Be 1
151+
$out.results[0].result.actualState.Output | Should -BeExactly 'Hello'
152+
}
153+
154+
It 'Allows to pass in secret() through variables' {
155+
$configYaml = @'
156+
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
157+
variables:
158+
myString: "[secret('MySecret')]"
159+
resources:
160+
- name: Database Connection
161+
type: Microsoft.DSC.Debug/Echo
162+
properties:
163+
output: "[variables('myString')]"
147164
'@
148165
$out = dsc -l trace config get -i $configYaml 2> $TestDrive/error.log | ConvertFrom-Json
149166
$LASTEXITCODE | Should -Be 0

0 commit comments

Comments
 (0)