@@ -30,22 +30,20 @@ resources:
3030 }
3131
3232 It ' <command> works' - TestCases @ (
33- @ { command = ' get' ; default = $true }
34- @ { command = ' export' ; default = $false }
33+ @ { command = ' get' }
34+ @ { command = ' export' }
3535 ) {
36- param ($command , $default )
36+ param ($command )
3737 $out = dsc config $command - i " $yaml " | ConvertFrom-Json - Depth 10
3838 $LASTEXITCODE | Should - Be 0
3939 if ($command -eq ' export' ) {
4040 $out.resources.count | Should - Be 1
41- # $out.resources[0]._includeDefaults | Should -Be $default
4241 $out.resources [0 ].properties | Should -Not - BeNullOrEmpty
4342 $out.resources [0 ].properties.port | Should - BeNullOrEmpty
4443 $out.resources [0 ].properties.passwordAuthentication | Should - Be ' no'
4544 $out.resources [0 ].properties._inheritedDefaults | Should - BeNullOrEmpty
4645 } else {
4746 $out.results.count | Should - Be 1
48- # $out.results._includeDefaults | Should -Be $default
4947 $out.results.result.actualState | Should -Not - BeNullOrEmpty
5048 $out.results.result.actualState.port [0 ] | Should - Be 22
5149 $out.results.result.actualState.passwordAuthentication | Should - Be ' no'
@@ -67,10 +65,10 @@ resources:
6765 _metadata:
6866 filepath: $filepath
6967"@
70- $out = dsc config $command - i " $export_yaml " | ConvertFrom-Json - Depth 10
68+ $out = dsc config export - i " $export_yaml " | ConvertFrom-Json - Depth 10
7169 $LASTEXITCODE | Should - Be 0
7270 $out.resources.count | Should - Be 1
73- ($out.resources [0 ].properties | Measure-Object ).count | Should - Be 1
71+ ($out.resources [0 ].properties.psobject.properties | Measure-Object ).count | Should - Be 1
7472 $out.resources [0 ].properties.passwordAuthentication | Should - Be ' no'
7573 }
7674
@@ -97,41 +95,36 @@ resources:
9795 $LASTEXITCODE | Should - Be 0
9896 if ($command -eq ' export' ) {
9997 $out.resources.count | Should - Be 1
100- # $out.resources[0].metadata.includeDefaults | Should -Be $includeDefaults
101- ($out.resources [0 ].properties | Measure-Object ).count | Should - Be 1
10298 $out.resources [0 ].properties.loglevel | Should - Be ' debug3'
10399 $out.resources [0 ].properties._inheritedDefaults | Should - Contain ' port'
104100 } else {
105101 $out.results.count | Should - Be 1
106- # $out.results.metadata.includeDefaults | Should -Be $includeDefaults
107- ($out.results.result.actualState.psobject.properties | Measure-Object ).count | Should - Be 1
102+ ($out.results.result.actualState.psobject.properties | Measure-Object ).count | Should - Be 2
108103 $out.results.result.actualState.loglevel | Should - Be ' debug3'
109104 $out.results.result.actualState._inheritedDefaults | Should - BeNullOrEmpty
110105 }
111106 }
112107
113- Context ' Explicit Default Setting Behavior ' {
108+ Context ' Surface a default value that has been set in file ' {
114109 BeforeAll {
115110 " Port 22" | Set-Content - Path $TestDrive / test_sshd_config
116111 }
117112
118113 It ' <command> works' - TestCases @ (
119- @ { command = ' get' ; default = $true }
120- @ { command = ' export' ; default = $false }
114+ @ { command = ' get' }
115+ @ { command = ' export' }
121116 ) {
122- param ($command , $default )
117+ param ($command )
123118 $out = dsc config $command - i " $yaml " | ConvertFrom-Json - Depth 10
124119 $LASTEXITCODE | Should - Be 0
125120 if ($command -eq ' export' ) {
126121 $out.resources.count | Should - Be 1
127- # $out.resources[0]._includeDefaults | Should -Be $default
128122 $out.resources [0 ].properties | Should -Not - BeNullOrEmpty
129123 $out.resources [0 ].properties.port[0 ] | Should - Be 22
130124 $out.resources [0 ].properties.passwordauthentication | Should - BeNullOrEmpty
131125 $out.resources [0 ].properties._inheritedDefaults | Should - BeNullOrEmpty
132126 } else {
133127 $out.results.count | Should - Be 1
134- # $out.results._includeDefaults | Should -Be $default
135128 $out.results.result.actualState | Should -Not - BeNullOrEmpty
136129 $out.results.result.actualState.port | Should - Be 22
137130 $out.results.result.actualState.passwordAuthentication | Should - Be ' yes'
0 commit comments