Skip to content

Commit f7069cb

Browse files
committed
Revert changes pwsh
1 parent 87da4d0 commit f7069cb

File tree

4 files changed

+25
-32
lines changed

4 files changed

+25
-32
lines changed

dsc/tests/dsc_extension_discover.tests.ps1

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,34 +23,28 @@ Describe 'Discover extension tests' {
2323
It 'Discover extensions' {
2424
$out = dsc extension list | ConvertFrom-Json
2525
$LASTEXITCODE | Should -Be 0
26-
if ($IsWindows) {
27-
$out.Count | Should -Be 4 -Because ($out | Out-String)
28-
$out[0].type | Should -Be 'Microsoft.DSC.Extension/Bicep'
29-
$out[0].version | Should -Be '0.1.0'
30-
$out[0].capabilities | Should -BeExactly @('import')
31-
$out[0].manifest | Should -Not -BeNullOrEmpty
32-
$out[1].type | Should -Be 'Microsoft.DSC.Extension/WindowsPowerShell'
33-
$out[1].version | Should -Be '0.1.0'
34-
$out[1].capabilities | Should -BeExactly @('import')
35-
$out[1].manifest | Should -Not -BeNullOrEmpty
36-
$out[2].type | Should -Be 'Microsoft.Windows.Appx/Discover'
37-
$out[2].version | Should -Be '0.1.0'
38-
$out[2].capabilities | Should -BeExactly @('discover')
39-
$out[2].manifest | Should -Not -BeNullOrEmpty
40-
$out[3].type | Should -BeExactly 'Test/Discover'
41-
$out[3].version | Should -BeExactly '0.1.0'
42-
$out[3].capabilities | Should -BeExactly @('discover')
43-
$out[3].manifest | Should -Not -BeNullOrEmpty
26+
$expectedExtensions = if ($IsWindows) {
27+
@(
28+
@{ type = 'Microsoft.DSC.Extension/Bicep'; version = '0.1.0'; capabilities = @('import') }
29+
@{ type = 'Microsoft.DSC.Transitional/PSDesiredStateConfiguration'; version = '0.1.0'; capabilities = @('import') }
30+
@{ type = 'Microsoft.Windows.Appx/Discover'; version = '0.1.0'; capabilities = @('discover') }
31+
@{ type = 'Test/Discover'; version = '0.1.0'; capabilities = @('discover') }
32+
)
4433
} else {
45-
$out.Count | Should -Be 2 -Because ($out | Out-String)
46-
$out[0].type | Should -Be 'Microsoft.DSC.Extension/Bicep'
47-
$out[0].version | Should -Be '0.1.0'
48-
$out[0].capabilities | Should -BeExactly @('import')
49-
$out[0].manifest | Should -Not -BeNullOrEmpty
50-
$out[1].type | Should -BeExactly 'Test/Discover'
51-
$out[1].version | Should -BeExactly '0.1.0'
52-
$out[1].capabilities | Should -BeExactly @('discover')
53-
$out[1].manifest | Should -Not -BeNullOrEmpty
34+
@(
35+
@{ type = 'Microsoft.DSC.Extension/Bicep'; version = '0.1.0'; capabilities = @('import') }
36+
@{ type = 'Test/Discover'; version = '0.1.0'; capabilities = @('discover') }
37+
)
38+
}
39+
40+
$out.Count | Should -Be $expectedExtensions.Count -Because ($out | Out-String)
41+
42+
foreach ($expected in $expectedExtensions) {
43+
$extension = $out | Where-Object { $_.type -eq $expected.type }
44+
$extension | Should -Not -BeNullOrEmpty -Because "Extension $($expected.type) should exist"
45+
$extension.version | Should -BeExactly $expected.version
46+
$extension.capabilities | Should -BeExactly $expected.capabilities
47+
$extension.manifest | Should -Not -BeNullOrEmpty
5448
}
5549
}
5650

extensions/powershell/win_powershell.tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Describe 'PowerShell extension tests' {
1616
$LASTEXITCODE | Should -Be 0 -Because (Get-Content -Path $TestDrive/error.log -Raw | Out-String)
1717
$out.results[0].result.actualState.Ensure | Should -Be 'Absent'
1818
$psFile = $psFile.ToString().Replace('\', '\\')
19-
(Get-Content -Path $TestDrive/error.log -Raw) | Should -Match "Importing file '$psFile' with extension 'Microsoft.DSC.Extension/WindowsPowerShell'"
19+
(Get-Content -Path $TestDrive/error.log -Raw) | Should -Match "Importing file '$psFile' with extension 'Microsoft.DSC.Transitional/PSDesiredStateConfiguration'"
2020
}
2121

2222
It 'Invalid PowerShell configuration document file returns error' -Skip:(!$IsWindows) {
@@ -37,7 +37,7 @@ configuration InvalidConfiguration {
3737
$LASTEXITCODE | Should -Be 2 -Because (Get-Content -Path $TestDrive/error.log -Raw | Out-String)
3838
$content = (Get-Content -Path $TestDrive/error.log -Raw)
3939
$psFile = $psFile.ToString().Replace('\', '\\')
40-
$content | Should -Match "Importing file '$psFile' with extension 'Microsoft.DSC.Extension/WindowsPowerShell'"
40+
$content | Should -Match "Importing file '$psFile' with extension 'Microsoft.DSC.Transitional/PSDesiredStateConfiguration'"
4141
$content | Should -Match "No DSC resources found in the imported modules."
4242
}
4343
}

extensions/powershell/windowspowershell.dsc.extension.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"$schema": "https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json",
3-
"type": "Microsoft.DSC.Extension/WindowsPowerShell",
3+
"type": "Microsoft.DSC.Transitional/PSDesiredStateConfiguration",
44
"version": "0.1.0",
5-
"description": "Enable passing Windows PowerShell v1 configuration document file directly to DSC. Works only on Windows.",
5+
"description": "Enable passing Windows PowerShell v1 configuration document file directly to DSC. Works only on Windows and leverages the built-in PSDesiredStateConfiguration module.",
66
"import": {
77
"fileExtensions": ["ps1"],
88
"executable": "powershell",

powershell-adapter/Tests/win_powershell_cache.tests.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ Describe 'WindowsPowerShell adapter resource tests - requires elevated permissio
4848
}
4949

5050
It 'Get works on Binary "File" resource' {
51-
5251
$testFile = "$testdrive\test.txt"
5352
'test' | Set-Content -Path $testFile -Force
5453
$r = '{"DestinationPath":"' + $testFile.replace('\', '\\') + '"}' | dsc resource get -r 'PSDesiredStateConfiguration/File' -f -

0 commit comments

Comments
 (0)