Skip to content

Commit 42aae1f

Browse files
committed
Fix up resource test
1 parent 592bd44 commit 42aae1f

File tree

5 files changed

+48
-50
lines changed

5 files changed

+48
-50
lines changed

.vscode/launch.json

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
// {
2-
// // Use IntelliSense to learn about possible attributes.
3-
// // Hover to view descriptions of existing attributes.
4-
// // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5-
// "version": "0.2.0",
6-
// "configurations": [
7-
// {
8-
// "type": "lldb",
9-
// "request": "launch",
10-
// "name": "Debug config",
11-
// "program": "${workspaceFolder}/config/target/debug/config",
12-
// "args": [
13-
// "list",
14-
// "r*"
15-
// ],
16-
// "cwd": "${workspaceFolder}"
17-
// },
18-
// {
19-
// "name": "(macOS) Attach",
20-
// "type": "lldb",
21-
// "request": "attach",
22-
// "pid": "${command:pickMyProcess}",
23-
// },
24-
// {
25-
// "name": "(Windows) Attach",
26-
// "type": "cppvsdbg",
27-
// "request": "attach",
28-
// "processId": "${command:pickProcess}",
29-
// },
30-
// {
31-
// "name": "Debug sshdconfig",
32-
// "type": "cppvsdbg",
33-
// "request": "launch",
34-
// "program": "${workspaceFolder}/sshdconfig/target/debug/sshdconfig.exe",
35-
// "args": ["get"],
36-
// "cwd": "${workspaceFolder}"
37-
// }
38-
// ]
39-
// }
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "lldb",
9+
"request": "launch",
10+
"name": "Debug config",
11+
"program": "${workspaceFolder}/config/target/debug/config",
12+
"args": [
13+
"list",
14+
"r*"
15+
],
16+
"cwd": "${workspaceFolder}"
17+
},
18+
{
19+
"name": "(macOS) Attach",
20+
"type": "lldb",
21+
"request": "attach",
22+
"pid": "${command:pickMyProcess}",
23+
},
24+
{
25+
"name": "(Windows) Attach",
26+
"type": "cppvsdbg",
27+
"request": "attach",
28+
"processId": "${command:pickProcess}",
29+
},
30+
{
31+
"name": "Debug sshdconfig",
32+
"type": "cppvsdbg",
33+
"request": "launch",
34+
"program": "${workspaceFolder}/sshdconfig/target/debug/sshdconfig.exe",
35+
"args": ["get"],
36+
"cwd": "${workspaceFolder}"
37+
}
38+
]
39+
}

build.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ if ($Test) {
518518
(Get-Module -Name Pester -ListAvailable).Path
519519
}
520520

521-
Invoke-Pester -ErrorAction Stop -Output Detailed -Verbose
521+
Invoke-Pester -ErrorAction Stop
522522
}
523523

524524
function Find-MakeAppx() {

powershell-adapter/Tests/TestClassResource/0.0.1/TestClassResource.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class TestClassResource : BaseTestClass {
107107
return $resultList.ToArray()
108108
}
109109

110-
[string] WhatIf() {
110+
[hashtable] WhatIf() {
111111
$out = @{
112112
Name = $this.Name
113113
_metadata = @{

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Describe 'PowerShell adapter resource tests' {
101101
$out = $yaml | dsc config export -f - 2>&1 | Out-String
102102
$LASTEXITCODE | Should -Be 2
103103
$out | Should -Not -BeNullOrEmpty
104-
$out | Should -BeLike "*ERROR*'Export' method not implemented by resource 'NoExport'*"
104+
$out | Should -BeLike "*ERROR*Method 'Export' not implemented by resource 'NoExport'*"
105105
}
106106

107107
It 'Custom psmodulepath in config works' {
@@ -322,11 +322,9 @@ Describe 'PowerShell adapter resource tests' {
322322
Ensure: 'Present'
323323
"@
324324
$out = dsc config set -i $yaml -w | ConvertFrom-Json
325-
326-
Write-Verbose -Message ("Output: $($out | ConvertTo-Json -Depth 10)") -Verbose
327325
$LASTEXITCODE | Should -Be 0
328-
$out.results.result.afterstate.result[0].name | Should -Be "TestClassResource"
329-
$out.results.result.afterstate.result[0]._metadata.whatIf | Should -Be "A test message from the WhatIf method of TestClassResource"
326+
$out.results.result.afterstate.name | Should -Be "TestClassResource"
327+
$out.results.result.afterstate._metadata.whatIf | Should -Be "A test message from the WhatIf method of TestClassResource"
330328
}
331329
}
332330

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,13 @@ Describe 'PowerShell adapter resource tests' {
199199
$files | Copy-Item -Destination $path4
200200

201201
$filePath = Join-Path $path1 'TestClassResource.psd1'
202-
(Get-Content -Raw $filePath).Replace("ModuleVersion = `'0.0.1`'", "ModuleVersion = `'1.0`'") | Set-Content $filePath
202+
(Get-Content -Raw $filePath).Replace("ModuleVersion = '0.0.1'", "ModuleVersion = `'1.0`'") | Set-Content $filePath
203203
$filePath = Join-Path $path2 'TestClassResource.psd1'
204-
(Get-Content -Raw $filePath).Replace("ModuleVersion = `'0.0.1`'", "ModuleVersion = `'1.1`'") | Set-Content $filePath
204+
(Get-Content -Raw $filePath).Replace("ModuleVersion = '0.0.1'", "ModuleVersion = `'1.1`'") | Set-Content $filePath
205205
$filePath = Join-Path $path3 'TestClassResource.psd1'
206-
(Get-Content -Raw $filePath).Replace("ModuleVersion = `'0.0.1`'", "ModuleVersion = `'2.0`'") | Set-Content $filePath
206+
(Get-Content -Raw $filePath).Replace("ModuleVersion = '0.0.1'", "ModuleVersion = `'2.0`'") | Set-Content $filePath
207207
$filePath = Join-Path $path4 'TestClassResource.psd1'
208-
(Get-Content -Raw $filePath).Replace("ModuleVersion = `'0.0.1`'", "ModuleVersion = `'2.0.1`'") | Set-Content $filePath
208+
(Get-Content -Raw $filePath).Replace("ModuleVersion = '0.0.1'", "ModuleVersion = '2.0.1'") | Set-Content $filePath
209209

210210

211211
$oldPath = $env:PSModulePath

0 commit comments

Comments
 (0)