@@ -94,8 +94,8 @@ Describe 'tests for resource discovery' {
9494 try {
9595 $env: DSC_RESOURCE_PATH = $testdrive
9696 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 " )
9999 }
100100 finally {
101101 $env: DSC_RESOURCE_PATH = $oldPath
@@ -113,7 +113,6 @@ Describe 'tests for resource discovery' {
113113 $env: DSC_RESOURCE_PATH = $null
114114 $env: PSModulePath += [System.IO.Path ]::PathSeparator + $TestClassResourcePath
115115 dsc resource list - a Microsoft.DSC/ PowerShell | Out-Null
116- gc - raw $script :lookupTableFilePath
117116 $script :lookupTableFilePath | Should - FileContentMatchExactly ' Microsoft.DSC/PowerShell'
118117 Test-Path $script :lookupTableFilePath - PathType Leaf | Should - BeTrue
119118 $env: PSModulePath = $oldPSModulePath
@@ -149,16 +148,16 @@ Describe 'tests for resource discovery' {
149148 Test-Path $script :lookupTableFilePath - PathType Leaf | Should - BeFalse
150149
151150 # 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
153152 " $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 " )
155154
156155 # second invocation (without an update) should use but not save adapter lookup table
157156 " {'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"
159158
160159 # 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
162161 " $TestDrive /tracing.txt" | Should - FileContentMatchExactly " Saving lookup table"
163162
164163 $env: PSModulePath = $oldPSModulePath
@@ -175,19 +174,7 @@ Describe 'tests for resource discovery' {
175174 ) {
176175 param ($cmdline )
177176
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
191178 $LASTEXITCODE | Should - Be 7
192179 }
193180
0 commit comments