Skip to content

Commit 11cd173

Browse files
author
Andrew
committed
Updated tests for WinPS
1 parent 9366b56 commit 11cd173

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

powershell-adapter/Tests/powershellgroup.config.tests.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,22 @@ Describe 'PowerShell adapter resource tests' {
1111
$env:PSModulePath += [System.IO.Path]::PathSeparator + $PSScriptRoot
1212
$pwshConfigPath = Join-path $PSScriptRoot "class_ps_resources.dsc.yaml"
1313
$winpsConfigPath = Join-path $PSScriptRoot "winps_resource.dsc.yaml"
14+
15+
$cacheFilePath = Join-Path $env:LocalAppData "dscv3classcache.json"
16+
if ($IsLinux -or $IsMacOS) {
17+
$cacheFilePath = Join-Path $env:HOME ".dsc" "dscv3classcache.json"
18+
}
19+
$cacheFilePath_v5 = Join-Path $env:LocalAppData "dscv3classcache-v5.json"
1420
}
1521
AfterAll {
1622
$env:PSModulePath = $OldPSModulePath
1723
}
1824

25+
BeforeEach {
26+
Remove-Item -Force -ea SilentlyContinue -Path $cacheFilePath
27+
Remove-Item -Force -ea SilentlyContinue -Path $cacheFilePath_v5
28+
}
29+
1930
It 'Get works on config with class-based and script-based resources' -Skip:(!$IsWindows){
2031

2132
$r = Get-Content -Raw $pwshConfigPath | dsc config get

powershell-adapter/Tests/powershellgroup.resource.tests.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,22 @@ Describe 'PowerShell adapter resource tests' {
99
}
1010
$OldPSModulePath = $env:PSModulePath
1111
$env:PSModulePath += [System.IO.Path]::PathSeparator + $PSScriptRoot
12+
13+
$cacheFilePath = Join-Path $env:LocalAppData "dscv3classcache.json"
14+
if ($IsLinux -or $IsMacOS) {
15+
$cacheFilePath = Join-Path $env:HOME ".dsc" "dscv3classcache.json"
16+
}
17+
$cacheFilePath_v5 = Join-Path $env:LocalAppData "dscv3classcache-v5.json"
1218
}
1319
AfterAll {
1420
$env:PSModulePath = $OldPSModulePath
1521
}
1622

23+
BeforeEach {
24+
Remove-Item -Force -ea SilentlyContinue -Path $cacheFilePath
25+
Remove-Item -Force -ea SilentlyContinue -Path $cacheFilePath_v5
26+
}
27+
1728
It 'Discovery includes class-based and script-based resources ' -Skip:(!$IsWindows){
1829

1930
$r = dsc resource list * -a Microsoft.DSC/PowerShell

0 commit comments

Comments
 (0)