Skip to content

Commit da9d8a2

Browse files
author
Steve Lee (POWERSHELL HE/HIM) (from Dev Box)
committed
fix windows tests
1 parent 66cdbc8 commit da9d8a2

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

dsc/tests/dsc_config_get.tests.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ Describe 'dsc config get tests' {
2626

2727
It 'will fail if resource schema does not match' -Skip:(!$IsWindows) {
2828
$jsonPath = Join-Path $PSScriptRoot '../examples/invalid_schema.dsc.yaml'
29-
$config = Get-Content $jsonPath -Raw
30-
$testError = & {$config | dsc config get -f - 2>&1}
31-
$testError[0] | Should -match 'error:'
29+
$testError = & {dsc config get -f $jsonPath 2>&1}
30+
$testError[0] | Should -match 'Schema:'
3231
$LASTEXITCODE | Should -Be 2
3332
}
3433

dsc/tests/dsc_whatif.tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ Describe 'whatif tests' {
3535
properties:
3636
keyPath: 'HKCU\1\2'
3737
"@
38-
$what_if_result = $config_yaml | dsc config set -w -f - | ConvertFrom-Json
39-
$set_result = $config_yaml | dsc config set | ConvertFrom-Json
38+
$what_if_result = dsc config set -w -i $config_yaml | ConvertFrom-Json
39+
$set_result = dsc config set -i $config_yaml | ConvertFrom-Json
4040
$what_if_result.metadata.'Microsoft.DSC'.executionType | Should -BeExactly 'WhatIf'
4141
$what_if_result.results.result.beforeState._exist | Should -Be $set_result.results.result.beforeState._exist
4242
$what_if_result.results.result.beforeState.keyPath | Should -Be $set_result.results.result.beforeState.keyPath

powershell-adapter/Tests/win_powershellgroup.tests.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT License.
33

4-
Describe 'WindowsPowerShell adapter resource tests' {
4+
Describe 'WindowsPowerShell adapter resource tests - requires elevated permissions' {
55

66
BeforeAll {
77
if ($isWindows) {
@@ -63,12 +63,12 @@ Describe 'WindowsPowerShell adapter resource tests' {
6363

6464
It 'Get works on config with File resource for WinPS' -Skip:(!$IsWindows){
6565

66-
$testFile = "$testdrive\test.txt"
67-
'test' | Set-Content -Path $testFile -Force
68-
$r = (Get-Content -Raw $winpsConfigPath).Replace('c:\test.txt',"$testFile") | dsc config get -f -
69-
$LASTEXITCODE | Should -Be 0
70-
$res = $r | ConvertFrom-Json
71-
$res.results[0].result.actualState.result[0].properties.DestinationPath | Should -Be "$testFile"
66+
$testFile = "$testdrive\test.txt"
67+
'test' | Set-Content -Path $testFile -Force
68+
$r = (Get-Content -Raw $winpsConfigPath).Replace('c:\test.txt',"$testFile") | dsc config get -f -
69+
$LASTEXITCODE | Should -Be 0
70+
$res = $r | ConvertFrom-Json
71+
$res.results[0].result.actualState.result[0].properties.DestinationPath | Should -Be "$testFile"
7272
}
7373

7474
It 'Verify that there are no cache rebuilds for several sequential executions' -Skip:(!$IsWindows) {

wmi-adapter/Tests/wmi.tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Describe 'WMI adapter resource tests' {
4848

4949
It 'Example config works' -Skip:(!$IsWindows) {
5050
$configPath = Join-Path $PSScriptRoot '..\..\configurations\windows\windows_inventory.dsc.yaml'
51-
$r = dsc config get -p $configPath
51+
$r = dsc config get -f $configPath
5252
$LASTEXITCODE | Should -Be 0
5353
$r | Should -Not -BeNullOrEmpty
5454
$res = $r | ConvertFrom-Json

0 commit comments

Comments
 (0)