@@ -12,7 +12,7 @@ Describe 'Tests for the secret() function and extensions' {
12
12
$env: PATH = $oldPath
13
13
}
14
14
15
- It ' Call secret() function with just a name' {
15
+ It ' Just a secret name' {
16
16
$configYaml = @'
17
17
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
18
18
resources:
@@ -27,7 +27,7 @@ Describe 'Tests for the secret() function and extensions' {
27
27
$out.results [0 ].result.actualState.Output | Should - BeExactly ' Hello'
28
28
}
29
29
30
- It ' Call secret() function with a name and vault' {
30
+ It ' Name and vault' {
31
31
$configYaml = @'
32
32
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
33
33
resources:
@@ -42,7 +42,7 @@ Describe 'Tests for the secret() function and extensions' {
42
42
$out.results [0 ].result.actualState.Output | Should - BeExactly ' Hello2'
43
43
}
44
44
45
- It ' Call secret() function with a name that does not exist' {
45
+ It ' Name that does not exist' {
46
46
$configYaml = @'
47
47
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
48
48
resources:
@@ -57,7 +57,7 @@ Describe 'Tests for the secret() function and extensions' {
57
57
$errorMessage | Should -Match " Secret 'NonExistentSecret' not found"
58
58
}
59
59
60
- It ' Call secret() function with a vault that does not exist' {
60
+ It ' Vault that does not exist' {
61
61
$configYaml = @'
62
62
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
63
63
resources:
@@ -72,7 +72,7 @@ Describe 'Tests for the secret() function and extensions' {
72
72
$errorMessage | Should -Match " Secret 'MySecret' not found"
73
73
}
74
74
75
- It ' Call secret() function with a duplicate secret' {
75
+ It ' Duplicate secret' {
76
76
$configYaml = @'
77
77
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
78
78
resources:
@@ -84,10 +84,10 @@ Describe 'Tests for the secret() function and extensions' {
84
84
dsc - l trace config get - i $configYaml 2> $TestDrive / error.log | ConvertFrom-Json
85
85
$LASTEXITCODE | Should - Be 2
86
86
$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"
88
88
}
89
89
90
- It ' Call secret() function with secret and vault to disambiguate' {
90
+ It ' Secret and vault to disambiguate' {
91
91
$configYaml = @'
92
92
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
93
93
resources:
@@ -101,4 +101,19 @@ Describe 'Tests for the secret() function and extensions' {
101
101
$out.results.Count | Should - Be 1
102
102
$out.results [0 ].result.actualState.Output | Should - BeExactly ' World'
103
103
}
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
+ }
104
119
}
0 commit comments