@@ -94,8 +94,8 @@ Describe 'tests for resource discovery' {
94
94
try {
95
95
$env: DSC_RESOURCE_PATH = $testdrive
96
96
Set-Content - Path " $testdrive /test.dsc.resource.json" - Value $manifest
97
- $null = dsc resource list 2> $TestDrive / error.log
98
- ( Get-Content - Path $TestDrive / error.log - Raw) | Should -Match ' WARN.*?does not use semver'
97
+ $null = dsc resource list 2> " $testdrive /error.txt "
98
+ " $testdrive /error.txt " | Should - FileContentMatchExactly ' WARN.*?does not use semver' - Because ( Get-Content - Raw " $testdrive /error.txt " )
99
99
}
100
100
finally {
101
101
$env: DSC_RESOURCE_PATH = $oldPath
@@ -113,7 +113,6 @@ Describe 'tests for resource discovery' {
113
113
$env: DSC_RESOURCE_PATH = $null
114
114
$env: PSModulePath += [System.IO.Path ]::PathSeparator + $TestClassResourcePath
115
115
dsc resource list - a Microsoft.DSC/ PowerShell | Out-Null
116
- gc - raw $script :lookupTableFilePath
117
116
$script :lookupTableFilePath | Should - FileContentMatchExactly ' Microsoft.DSC/PowerShell'
118
117
Test-Path $script :lookupTableFilePath - PathType Leaf | Should - BeTrue
119
118
$env: PSModulePath = $oldPSModulePath
@@ -149,16 +148,16 @@ Describe 'tests for resource discovery' {
149
148
Test-Path $script :lookupTableFilePath - PathType Leaf | Should - BeFalse
150
149
151
150
# initial invocation should populate and save adapter lookup table
152
- dsc - l trace resource list - a Microsoft.DSC/ PowerShell 2> $TestDrive / tracing.txt
151
+ $null = dsc - l trace resource list - a Microsoft.DSC/ PowerShell 2> $TestDrive / tracing.txt
153
152
" $TestDrive /tracing.txt" | Should - FileContentMatchExactly " Read 0 items into lookup table"
154
- " $TestDrive /tracing.txt" | Should - FileContentMatchExactly " Saving lookup table"
153
+ " $TestDrive /tracing.txt" | Should - FileContentMatchExactly " Saving lookup table" - Because ( Get-Content - Raw " $TestDrive /tracing.txt " )
155
154
156
155
# second invocation (without an update) should use but not save adapter lookup table
157
156
" {'Name':'TestClassResource1'}" | dsc - l trace resource get - r ' TestClassResource/TestClassResource' -f - 2> $TestDrive / tracing.txt
158
- " $TestDrive /tracing.txt" | Should -Not - FileContentMatchExactly " Saving lookup table" - Because ( Get-Content $TestDrive / tracing.txt - Raw)
157
+ " $TestDrive /tracing.txt" | Should -Not - FileContentMatchExactly " Saving lookup table"
159
158
160
159
# third invocation (with an update) should save updated adapter lookup table
161
- dsc - l trace resource list - a Test/ TestGroup 2> $TestDrive / tracing.txt
160
+ $null = dsc - l trace resource list - a Test/ TestGroup 2> $TestDrive / tracing.txt
162
161
" $TestDrive /tracing.txt" | Should - FileContentMatchExactly " Saving lookup table"
163
162
164
163
$env: PSModulePath = $oldPSModulePath
@@ -175,19 +174,7 @@ Describe 'tests for resource discovery' {
175
174
) {
176
175
param ($cmdline )
177
176
178
- $out = dsc resource get - r abc/ def 2> $null
179
- $LASTEXITCODE | Should - Be 7
180
- $out = dsc resource get -- all - r abc/ def 2> $null
181
- $LASTEXITCODE | Should - Be 7
182
- $out = ' abc' | dsc resource set - r abc/ def -f - 2> $null
183
- $LASTEXITCODE | Should - Be 7
184
- $out = ' abc' | dsc resource test - r abc/ def -f - 2> $null
185
- $LASTEXITCODE | Should - Be 7
186
- $out = ' abc' | dsc resource delete - r abc/ def -f - 2> $null
187
- $LASTEXITCODE | Should - Be 7
188
- $out = dsc resource export - r abc/ def 2> $null
189
- $LASTEXITCODE | Should - Be 7
190
- $out = dsc resource schema - r abc/ def 2> $null
177
+ Invoke-Expression $cmdline 2> $null
191
178
$LASTEXITCODE | Should - Be 7
192
179
}
193
180
0 commit comments