You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Details of the scenario you tried and the problem that is occurring
Tests in xWindowsOptionalFeatureSet.Integration.Tests.ps1 fail on the first execution due to an attempt to access the windowsOptionalFeatureName variable before it's been set. Subsequent test runs work just fine.
Verbose logs showing the problem
First execution:
Executing script C:\Program Files\WindowsPowerShell\Modules\xPSDesiredStateConfiguration\tests\Integration\xWindowsOptionalFeatureSet.Integration.Tests.ps1
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 9ms
[+] 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 2ms
[+] Should have disabled Windows optional feature Xps-Foundation-Xps-Viewer before the configuration 2ms
[+] Should compile and run configuration 46.84s
[+] Should be able to retrieve Windows optional feature RSAT-RDS-Tools-Feature after the configuration 4ms
[+] Should have enabled Windows optional feature RSAT-RDS-Tools-Feature after the configuration 5ms
[+] Should be able to retrieve Windows optional feature Xps-Foundation-Xps-Viewer after the configuration 2ms
[+] Should have enabled Windows optional feature Xps-Foundation-Xps-Viewer after the configuration 2ms
[+] Should have created the log file 3ms
[+] Should have created content in the log file 4ms
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 2ms
[+] Should have enabled Windows optional feature Xps-Foundation-Xps-Viewer before the configuration 7ms
[+] Should compile and run configuration 6.14s
[+] Should be able to retrieve Windows optional feature RSAT-RDS-Tools-Feature after the confguration 4ms
[+] 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 4ms
[+] Should have disabled Windows optional feature Xps-Foundation-Xps-Viewer after the confguration 4ms
[+] Should have created the log file 3ms
[+] Should have created content in the log file 7ms
[-] 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
Tests completed in 1424.65s
Subsequent executions:
Executing script C:\Program Files\WindowsPowerShell\Modules\xPSDesiredStateConfiguration\tests\Integration\xWindowsOptionalFeatureSet.Integration.Tests.ps1
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 1ms
[+] Should have disabled Windows optional feature RSAT-RDS-Tools-Feature before the configuration 1ms
[+] Should be able to retrieve Windows optional feature Xps-Foundation-Xps-Viewer before the configuration 3ms
[+] Should have disabled Windows optional feature Xps-Foundation-Xps-Viewer before the configuration 3ms
[+] Should compile and run configuration 57.02s
[+] Should be able to retrieve Windows optional feature RSAT-RDS-Tools-Feature after the configuration 2ms
[+] Should have enabled Windows optional feature RSAT-RDS-Tools-Feature after the configuration 4ms
[+] 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 2ms
[+] Should have created the log file 2ms
[+] Should have created content in the log file 2ms
Context Uninstall two valid Windows optional features
[+] Should be able to retrieve Windows optional feature RSAT-RDS-Tools-Feature before the configuration 4ms
[+] Should have enabled Windows optional feature RSAT-RDS-Tools-Feature before the configuration 1ms
[+] Should be able to retrieve Windows optional feature Xps-Foundation-Xps-Viewer before the configuration 4ms
[+] Should have enabled Windows optional feature Xps-Foundation-Xps-Viewer before the configuration 8ms
[+] Should compile and run configuration 6.63s
[+] Should be able to retrieve Windows optional feature RSAT-RDS-Tools-Feature after the confguration 4ms
[+] Should have disabled Windows optional feature RSAT-RDS-Tools-Feature after the confguration 5ms
[+] Should be able to retrieve Windows optional feature Xps-Foundation-Xps-Viewer after the confguration 4ms
[+] Should have disabled Windows optional feature Xps-Foundation-Xps-Viewer after the confguration 6ms
[+] Should have created the log file 19ms
[+] Should have created content in the log file 2ms
Suggested solution to the issue
Make sure $windowsOptionalFeatureName is set before trying to access it
Version of the DSC module that was used ('dev' if using current dev branch)
dev
The text was updated successfully, but these errors were encountered:
mhendric
changed the title
xWindowsOptionalFeatureSet.Integration.Tests.ps1: Tests fail on first execution due to access of unassigned variable
MSFT_xWindowsOptionalFeature.Integration.Tests.ps1: Tests fail on first execution due to access of unassigned variable
Apr 5, 2019
mhendric
changed the title
MSFT_xWindowsOptionalFeature.Integration.Tests.ps1: Tests fail on first execution due to access of unassigned variable
xWindowsOptionalFeatureSet.Integration.Tests.ps1: Tests fail on first execution due to access of unassigned variable
Apr 6, 2019
Details of the scenario you tried and the problem that is occurring
Tests in xWindowsOptionalFeatureSet.Integration.Tests.ps1 fail on the first execution due to an attempt to access the windowsOptionalFeatureName variable before it's been set. Subsequent test runs work just fine.
Verbose logs showing the problem
First execution:
Subsequent executions:
Suggested solution to the issue
Make sure $windowsOptionalFeatureName is set before trying to access it
Version of the DSC module that was used ('dev' if using current dev branch)
dev
The text was updated successfully, but these errors were encountered: