Skip to content

Commit 4cca197

Browse files
committed
Fix discovery test
1 parent 75aebd7 commit 4cca197

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

dsc/tests/dsc_extension_discover.tests.ps1

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,41 @@ Describe 'Discover extension tests' {
2424
$out = dsc extension list | ConvertFrom-Json
2525
$LASTEXITCODE | Should -Be 0
2626
if ($IsWindows) {
27-
$out.Count | Should -Be 4 -Because ($out | Out-String)
27+
$out.Count | Should -Be 5 -Because ($out | Out-String)
2828
$out[0].type | Should -Be 'Microsoft.DSC.Extension/Bicep'
2929
$out[0].version | Should -Be '0.1.0'
3030
$out[0].capabilities | Should -BeExactly @('import')
3131
$out[0].manifest | Should -Not -BeNullOrEmpty
32-
$out[1].type | Should -Be 'Microsoft.DSC.Extension/WindowsPowerShell'
32+
$out[1].type | Should -Be 'Microsoft.DSC.Extension/PowerShell'
3333
$out[1].version | Should -Be '0.1.0'
3434
$out[1].capabilities | Should -BeExactly @('import')
3535
$out[1].manifest | Should -Not -BeNullOrEmpty
36-
$out[2].type | Should -Be 'Microsoft.Windows.Appx/Discover'
36+
$out[2].type | Should -Be 'Microsoft.DSC.Extension/WindowsPowerShell'
3737
$out[2].version | Should -Be '0.1.0'
38-
$out[2].capabilities | Should -BeExactly @('discover')
38+
$out[2].capabilities | Should -BeExactly @('import')
3939
$out[2].manifest | Should -Not -BeNullOrEmpty
40-
$out[3].type | Should -BeExactly 'Test/Discover'
41-
$out[3].version | Should -BeExactly '0.1.0'
40+
$out[3].type | Should -Be 'Microsoft.Windows.Appx/Discover'
41+
$out[3].version | Should -Be '0.1.0'
4242
$out[3].capabilities | Should -BeExactly @('discover')
4343
$out[3].manifest | Should -Not -BeNullOrEmpty
44+
$out[4].type | Should -BeExactly 'Test/Discover'
45+
$out[4].version | Should -BeExactly '0.1.0'
46+
$out[4].capabilities | Should -BeExactly @('discover')
47+
$out[4].manifest | Should -Not -BeNullOrEmpty
4448
} else {
45-
$out.Count | Should -Be 2 -Because ($out | Out-String)
49+
$out.Count | Should -Be 3 -Because ($out | Out-String)
4650
$out[0].type | Should -Be 'Microsoft.DSC.Extension/Bicep'
4751
$out[0].version | Should -Be '0.1.0'
4852
$out[0].capabilities | Should -BeExactly @('import')
4953
$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')
54+
$out[1].type | Should -Be 'Microsoft.DSC.Extension/PowerShell'
55+
$out[1].version | Should -Be '0.1.0'
56+
$out[1].capabilities | Should -BeExactly @('import')
5357
$out[1].manifest | Should -Not -BeNullOrEmpty
58+
$out[2].type | Should -BeExactly 'Test/Discover'
59+
$out[2].version | Should -BeExactly '0.1.0'
60+
$out[2].capabilities | Should -BeExactly @('discover')
61+
$out[2].manifest | Should -Not -BeNullOrEmpty
5462
}
5563
}
5664

extensions/powershell/convertDscResource.psm1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ if ($Script:IsPowerShellCore) {
66
}
77
Import-Module -Name 'PSDesiredStateConfiguration' -MinimumVersion 2.0.7 -Prefix 'Pwsh' -WarningAction SilentlyContinue -ErrorAction Stop
88
} else {
9+
"Loaded module paths: $env:PSModulePath" | Write-DscTrace -Operation Trace
910
Import-Module -Name 'PSDesiredStateConfiguration' -RequiredVersion 1.1 -WarningAction SilentlyContinue -ErrorAction Stop
1011
}
1112

extensions/powershell/powershell.tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ BeforeDiscovery {
1010
}
1111

1212
Describe 'PowerShell extension tests' {
13-
It 'Example PowerShell file should work' -Skip:(!$IsWindows -or !$isElevated) {
13+
It 'Example PowerShell file should work' -Skip:(!$isElevated) {
1414
$powerShellConfiguration = @"
1515
configuration TestClassConfiguration {
1616
Import-DscResource -ModuleName TestClassResource
@@ -32,7 +32,7 @@ configuration TestClassConfiguration {
3232
(Get-Content -Path $TestDrive/error.log -Raw) | Should -Match "Importing file '$config_path' with extension 'Microsoft.DSC.Extension/PowerShell'"
3333
}
3434

35-
It 'Invalid PowerShell configuration document file returns error' -Skip:(!$IsWindows) {
35+
It 'Invalid PowerShell configuration document file returns error' {
3636
$psFile = "$TestDrive/invalid.ps1"
3737
Set-Content -Path $psFile -Value @"
3838
configuration InvalidConfiguration {

0 commit comments

Comments
 (0)