@@ -12,7 +12,7 @@ Describe 'Tests for the secret() function and extensions' {
1212 $env: PATH = $oldPath
1313 }
1414
15- It ' Call secret() function with just a name' {
15+ It ' Just a secret name' {
1616 $configYaml = @'
1717 $schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
1818 resources:
@@ -27,7 +27,7 @@ Describe 'Tests for the secret() function and extensions' {
2727 $out.results [0 ].result.actualState.Output | Should - BeExactly ' Hello'
2828 }
2929
30- It ' Call secret() function with a name and vault' {
30+ It ' Name and vault' {
3131 $configYaml = @'
3232 $schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
3333 resources:
@@ -42,7 +42,7 @@ Describe 'Tests for the secret() function and extensions' {
4242 $out.results [0 ].result.actualState.Output | Should - BeExactly ' Hello2'
4343 }
4444
45- It ' Call secret() function with a name that does not exist' {
45+ It ' Name that does not exist' {
4646 $configYaml = @'
4747 $schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
4848 resources:
@@ -57,7 +57,7 @@ Describe 'Tests for the secret() function and extensions' {
5757 $errorMessage | Should -Match " Secret 'NonExistentSecret' not found"
5858 }
5959
60- It ' Call secret() function with a vault that does not exist' {
60+ It ' Vault that does not exist' {
6161 $configYaml = @'
6262 $schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
6363 resources:
@@ -72,7 +72,7 @@ Describe 'Tests for the secret() function and extensions' {
7272 $errorMessage | Should -Match " Secret 'MySecret' not found"
7373 }
7474
75- It ' Call secret() function with a duplicate secret' {
75+ It ' Duplicate secret' {
7676 $configYaml = @'
7777 $schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
7878 resources:
@@ -84,10 +84,10 @@ Describe 'Tests for the secret() function and extensions' {
8484 dsc - l trace config get - i $configYaml 2> $TestDrive / error.log | ConvertFrom-Json
8585 $LASTEXITCODE | Should - Be 2
8686 $errorMessage = Get-Content - Raw - Path $TestDrive / error.log
87- $errorMessage | Should -Match " Multiple secrets with the same name 'DuplicateSecret' was returned, try specifying a vault"
87+ $errorMessage | Should -Match " Multiple secrets with the same name 'DuplicateSecret' and different values was returned, try specifying a vault"
8888 }
8989
90- It ' Call secret() function with secret and vault to disambiguate' {
90+ It ' Secret and vault to disambiguate' {
9191 $configYaml = @'
9292 $schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
9393 resources:
@@ -101,4 +101,19 @@ Describe 'Tests for the secret() function and extensions' {
101101 $out.results.Count | Should - Be 1
102102 $out.results [0 ].result.actualState.Output | Should - BeExactly ' World'
103103 }
104+
105+ It ' Same secret name and value in different extensions' {
106+ $configYaml = @'
107+ $schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
108+ resources:
109+ - name: Echo
110+ type: Microsoft.DSC.Debug/Echo
111+ properties:
112+ output: "[secret('DuplicateSame')]"
113+ '@
114+ $out = dsc - l trace config get - i $configYaml 2> $TestDrive / error.log | ConvertFrom-Json
115+ $LASTEXITCODE | Should - Be 0
116+ $out.results.Count | Should - Be 1
117+ $out.results [0 ].result.actualState.Output | Should - BeExactly ' SameSecret'
118+ }
104119}
0 commit comments