Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests\Integration\xWindowsOptionalFeatureSet.Integration.Tests.ps1: Broken on Windows Server 2019 #586

Closed
mhendric opened this issue Mar 6, 2019 · 1 comment · Fixed by #587
Labels
bug The issue is a bug. in progress The issue is being actively worked on by someone.

Comments

@mhendric
Copy link
Contributor

mhendric commented Mar 6, 2019

Details of the scenario you tried and the problem that is occurring

Tests in 'Tests\Integration\xWindowsOptionalFeatureSet.Integration.Tests.ps1' appear to be broken (at least) on Windows Server 2019. The problem occurs when the tests try to disable a feature. On my test machine, there is a third Disabled state, DisabledWithPayloadRemoved, which these tests are not looking for.

Verbose logs showing the problem

Here's what my feature state looks like:

PS C:\Users\Administrator> $optFeatures = Get-WindowsOptionalFeature -Online
PS C:\Users\Administrator> $optFeatures | where {$_.FeatureName -like "*xps*"}


FeatureName : Printing-XPSServices-Features
State       : Enabled

FeatureName : Xps-Foundation-Xps-Viewer
State       : DisabledWithPayloadRemoved

PS C:\Users\Administrator> ($optFeatures | where {$_.FeatureName -like "*xps*"})[1].State.GetType().GetEnumNames()
Disabled
DisablePending
Enabled
EnablePending
Superseded
PartiallyInstalled
DisabledWithPayloadRemoved

Here's the test results:

Executing script C:\Program Files\WindowsPowerShell\Modules\xPSDesiredStateConfiguration\Tests\Integration\xWindowsOptionalFeatureSet.Integration.Tests.ps1
WARNING: There is no operation running currently. Stop will return without any action.

  Describing xWindowsOptionalFeatureSet Integration Tests

    Context Install two valid Windows optional features
      [+] Should be able to retrieve Windows optional feature RSAT-RDS-Tools-Feature before the configuration 2ms
      [+] Should have disabled Windows optional feature RSAT-RDS-Tools-Feature before the configuration 2ms
      [+] Should be able to retrieve Windows optional feature Xps-Foundation-Xps-Viewer before the configuration 1ms
      [-] Should have disabled Windows optional feature Xps-Foundation-Xps-Viewer before the configuration 3ms
        Expected $true, but got $false.
        90:                     $windowsOptionalFeature.State -in $script:disabledStates | Should -Be $true
        at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\xPSDesiredStateConfiguration\Tests\Integration\xWindowsOptionalFeatureSet.Integration.Tests.ps1: line 90
      [-] Should compile and run configuration 17.11s
        Expected no exception to be thrown, but an exception "Enable-WindowsOptionalFeature failed. Error code = 0x800f0950" was thrown from C:\Program Files\WindowsPowerShell\Module
s\xPSDesiredStateConfiguration\Tests\Integration\xWindowsOptionalFeatureSet.Integration.Tests.ps1:98 char:21
            + ...             Start-DscConfiguration -Path $TestDrive -ErrorAction 'Sto ...
            +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
        99:                 } | Should -Not -Throw
        at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\xPSDesiredStateConfiguration\Tests\Integration\xWindowsOptionalFeatureSet.Integration.Tests.ps1: line 95
      [+] Should be able to retrieve Windows optional feature RSAT-RDS-Tools-Feature after the configuration 6ms
      [+] Should have enabled Windows optional feature RSAT-RDS-Tools-Feature after the configuration 2ms
      [+] Should be able to retrieve Windows optional feature Xps-Foundation-Xps-Viewer after the configuration 1ms
      [-] Should have enabled Windows optional feature Xps-Foundation-Xps-Viewer after the configuration 19ms
        Expected $true, but got $false.
        120:                     $windowsOptionalFeature.State -in $script:enabledStates | Should -Be $true
        at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\xPSDesiredStateConfiguration\Tests\Integration\xWindowsOptionalFeatureSet.Integration.Tests.ps1: line 120
      [+] Should have created the log file 3ms
      [+] Should have created content in the log file 3ms

    Context Uninstall two valid Windows optional features
      [+] Should be able to retrieve Windows optional feature RSAT-RDS-Tools-Feature before the configuration 2ms
      [+] Should have enabled Windows optional feature RSAT-RDS-Tools-Feature before the configuration 2ms
      [+] Should be able to retrieve Windows optional feature Xps-Foundation-Xps-Viewer before the configuration 1ms
      [-] Should have enabled Windows optional feature Xps-Foundation-Xps-Viewer before the configuration 3ms
        Expected $true, but got $false.
        166:                     $windowsOptionalFeature.State -in $script:enabledStates | Should -Be $true
        at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\xPSDesiredStateConfiguration\Tests\Integration\xWindowsOptionalFeatureSet.Integration.Tests.ps1: line 166
      [+] Should compile and run configuration 5.15s
      [+] Should be able to retrieve Windows optional feature RSAT-RDS-Tools-Feature after the confguration 2ms
      [+] Should have disabled Windows optional feature RSAT-RDS-Tools-Feature after the confguration 2ms
      [+] Should be able to retrieve Windows optional feature Xps-Foundation-Xps-Viewer after the confguration 2ms
      [-] Should have disabled Windows optional feature Xps-Foundation-Xps-Viewer after the confguration 18ms
        Expected $true, but got $false.
        196:                     $windowsOptionalFeature.State -in $script:disabledStates | Should -Be $true
        at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\xPSDesiredStateConfiguration\Tests\Integration\xWindowsOptionalFeatureSet.Integration.Tests.ps1: line 196
      [+] Should have created the log file 8ms
      [+] Should have created content in the log file 3ms
    [-] Error occurred in Describe block 0ms
      RuntimeException: The variable '$windowsOptionalFeatureName' cannot be retrieved because it has not been set.
      at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\xPSDesiredStateConfiguration\Tests\Integration\xWindowsOptionalFeatureSet.Integration.Tests.ps1: line 51
      at Invoke-Blocks, C:\Program Files\WindowsPowerShell\Modules\Pester\4.7.1\Functions\SetupTeardown.ps1: line 144
      at Invoke-TestGroupTeardownBlocks, C:\Program Files\WindowsPowerShell\Modules\Pester\4.7.1\Functions\SetupTeardown.ps1: line 134
      at DescribeImpl, C:\Program Files\WindowsPowerShell\Modules\Pester\4.7.1\Functions\Describe.ps1: line 203
WARNING: There is no operation running currently. Stop will return without any action.

The operating system the target node is running

PS C:> Get-ComputerInfo -Property @(
'OsName',
'OsOperatingSystemSKU',
'OSArchitecture',
'WindowsVersion',
'WindowsBuildLabEx',
'OsLanguage',
'OsMuiLanguages')

OsName : Microsoft Windows Server 2019 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US}

Version and build of PowerShell the target node is running

PS C:> $PSVersionTable

Name Value


PSVersion 5.1.17763.316
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.316
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Version of the DSC module that was used ('dev' if using current dev branch)

dev

@mhendric mhendric added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Mar 6, 2019
@mhendric mhendric added in progress The issue is being actively worked on by someone. and removed help wanted The issue is up for grabs for anyone in the community. labels Mar 6, 2019
@mhendric
Copy link
Contributor Author

mhendric commented Mar 6, 2019

I got this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. in progress The issue is being actively worked on by someone.
Projects
None yet
1 participant