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

MSFT_xWindowsProcess.Integration.Tests.ps1: Doesn't work when module path contains spaces #605

Closed
mhendric opened this issue Mar 25, 2019 · 0 comments · Fixed by #610
Closed
Assignees
Labels
bug The issue is a bug.

Comments

@mhendric
Copy link
Contributor

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

Tests in MSFT_xWindowsProcess.Integration.Tests.ps1 currently fail when run from a module path that contains spaces.

Verbose logs showing the problem

PS C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration> invoke-pester .\MSFT_xWindowsProcess.Integration.Tests.ps1
Executing all tests in '.\MSFT_xWindowsProcess.Integration.Tests.ps1'

Executing script .\MSFT_xWindowsProcess.Integration.Tests.ps1
WARNING: There is no operation running currently. Stop will return without any action.

  Describing xWindowsProcess Integration Tests without Credential

    Context Should stop any current instances of the testProcess running
      [+] Should compile without throwing 5.9s
      [+] Should be able to call Get-DscConfiguration without throwing 94ms
      [+] Should return the correct configuration 164ms
      [+] Should not create a logfile 7ms

    Context Should start a new testProcess instance as running
      [+] Should not have a logfile already present 2ms
      [+] Should compile without throwing 819ms
      [+] Should be able to call Get-DscConfiguration without throwing 93ms
      [+] Should return the correct configuration 89ms
      [-] Should create a logfile 142ms
        Expected $true, but got $false.
        114:                 $pathResult | Should -Be $true
        at <ScriptBlock>, C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1: line 114

    Context Should not start a second new testProcess instance when one is already running
      [-] Should have a logfile already present 4ms
        Expected $true, but got $false.
        124:                 $pathResult | Should -Be $true
        at <ScriptBlock>, C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1: line 124
      [-] Should not throw when removing the log file 42ms
        Expected no exception to be thrown, but an exception "Cannot find path 'C:\Has Spaces\xPSDesiredStateConfiguration\Tests\processTestLog.txt' because it does not exist." was t
hrown from C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1:128 char:19
            +                 { Remove-Item -Path $logFilePath } | Should -Not -Thr ...
            +                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
        128:                 { Remove-Item -Path $logFilePath } | Should -Not -Throw
        at <ScriptBlock>, C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1: line 128
      [+] Should compile without throwing 220ms
      [+] Should be able to call Get-DscConfiguration without throwing 63ms
      [+] Should return the correct configuration 106ms
      [+] Should not create a logfile 2ms

    Context Should stop the testProcess instance from running
      [+] Should not have a logfile already present 3ms
      [+] Should compile without throwing 254ms
      [+] Should be able to call Get-DscConfiguration without throwing 55ms
      [+] Should return the correct configuration 42ms
      [+] Should not create a logfile 2ms

    Context Should return correct amount of processes running when more than 1 are running
      [+] Should not have a logfile already present 2ms
      [+] Should compile without throwing 361ms
      [+] Should start another process running 48ms
      [+] Should be able to call Get-DscConfiguration without throwing 289ms
      [+] Should return the correct configuration 87ms
      [-] Should create a logfile 5ms
        Expected $true, but got $false.
        247:                 $pathResult | Should -Be $true
        at <ScriptBlock>, C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1: line 247

    Context Should stop all of the testProcess instances from running
      [-] Should have a logfile already present 4ms
        Expected $true, but got $false.
        257:                 $pathResult | Should -Be $true
        at <ScriptBlock>, C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1: line 257
      [-] Should not throw when removing the log file 9ms
        Expected no exception to be thrown, but an exception "Cannot find path 'C:\Has Spaces\xPSDesiredStateConfiguration\Tests\processTestLog.txt' because it does not exist." was t
hrown from C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1:261 char:19
            +                 { Remove-Item -Path $logFilePath } | Should -Not -Thr ...
            +                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
        261:                 { Remove-Item -Path $logFilePath } | Should -Not -Throw
        at <ScriptBlock>, C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1: line 261
      [+] Should compile without throwing 1.11s
      [+] Should be able to call Get-DscConfiguration without throwing 81ms
      [+] Should return the correct configuration 49ms
      [+] Should not create a logfile 2ms

  Describing xWindowsProcess Integration Tests with Credential
VERBOSE: Creating account 'xPSDSCTestAdmin'
VERBOSE: Setting password on account at path 'WinNT://WORKGROUP/WIN2019TEST1/xPSDSCTestAdmin'
VERBOSE: Adding account 'xPSDSCTestAdmin' to group at path 'WinNT://WIN2019TEST1/Administrators,group'
VERBOSE: Adding account 'xPSDSCTestAdmin' to group at path 'WinNT://WIN2019TEST1/Remote Management Users,group'

    Context Should stop any current instances of the testProcess running
      [+] Should compile without throwing 498ms
      [+] Should be able to call Get-DscConfiguration without throwing 60ms
      [+] Should return the correct configuration 52ms
      [+] Should not create a logfile 3ms

    Context Should start a new testProcess instance as running
      [+] Should not have a logfile already present 2ms
      [-] Should compile without throwing 914ms
        Expected no exception to be thrown, but an exception "PowerShell DSC resource MSFT_xWindowsProcess  failed to execute Set-TargetResource functionality with error message: Exc
eption calling "CreateProcessAsUser" with "6" argument(s): "Could not create process. Error code:193" " was thrown from C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\M
SFT_xWindowsProcess.Integration.Tests.ps1:382 char:21
            + ...             Start-DscConfiguration -Path $configurationPath -ErrorAct ...
            +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
        383:                 } | Should -Not -Throw
        at <ScriptBlock>, C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1: line 373
WARNING: [WIN2019TEST1]:                            [] The GET operation will be carried against a pending configuration since the latest configuration has not converged yet.
      [+] Should be able to call Get-DscConfiguration without throwing 75ms
WARNING: [WIN2019TEST1]:                            [] The GET operation will be carried against a pending configuration since the latest configuration has not converged yet.
      [-] Should return the correct configuration 156ms
        Expected strings to be the same, but they were different.
        Expected length: 7
        Actual length:   6
        Strings differ at index 0.
        Expected: 'Present'
        But was:  'Absent'
        -----------^
        397:                 $currentConfig.Ensure | Should -Be 'Present'
        at <ScriptBlock>, C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1: line 397
      [-] Should create a logfile 10ms
        Expected $true, but got $false.
        403:                 $pathResult | Should -Be $true
        at <ScriptBlock>, C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1: line 403

    Context Should not start a second new testProcess instance when one is already running
      [-] Should have a logfile already present 5ms
        Expected $true, but got $false.
        413:                 $pathResult | Should -Be $true
        at <ScriptBlock>, C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1: line 413
      [-] Should not throw when removing the log file 5ms
        Expected no exception to be thrown, but an exception "Cannot find path 'C:\Has Spaces\xPSDesiredStateConfiguration\Tests\processTestLog.txt' because it does not exist." was t
hrown from C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1:417 char:19
            +                 { Remove-Item -Path $logFilePath } | Should -Not -Thr ...
            +                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
        417:                 { Remove-Item -Path $logFilePath } | Should -Not -Throw
        at <ScriptBlock>, C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1: line 417
      [-] Should compile without throwing 414ms
        Expected no exception to be thrown, but an exception "PowerShell DSC resource MSFT_xWindowsProcess  failed to execute Set-TargetResource functionality with error message: Exc
eption calling "CreateProcessAsUser" with "6" argument(s): "Could not create process. Error code:193" " was thrown from C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\M
SFT_xWindowsProcess.Integration.Tests.ps1:430 char:21
            + ...             Start-DscConfiguration -Path $configurationPath -ErrorAct ...
            +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
        431:                 } | Should -Not -Throw
        at <ScriptBlock>, C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1: line 421
WARNING: [WIN2019TEST1]:                            [] The GET operation will be carried against a pending configuration since the latest configuration has not converged yet.
      [+] Should be able to call Get-DscConfiguration without throwing 85ms
WARNING: [WIN2019TEST1]:                            [] The GET operation will be carried against a pending configuration since the latest configuration has not converged yet.
      [-] Should return the correct configuration 73ms
        Expected strings to be the same, but they were different.
        Expected length: 7
        Actual length:   6
        Strings differ at index 0.
        Expected: 'Present'
        But was:  'Absent'
        -----------^
        445:                 $currentConfig.Ensure | Should -Be 'Present'
        at <ScriptBlock>, C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1: line 445
      [+] Should not create a logfile 2ms

    Context Should stop the testProcess instance from running
      [+] Should not have a logfile already present 4ms
      [+] Should compile without throwing 295ms
      [+] Should be able to call Get-DscConfiguration without throwing 44ms
      [+] Should return the correct configuration 48ms
      [+] Should not create a logfile 3ms

    Context Should return correct amount of processes running when more than 1 are running
      [+] Should not have a logfile already present 2ms
      [-] Should compile without throwing 243ms
        Expected no exception to be thrown, but an exception "PowerShell DSC resource MSFT_xWindowsProcess  failed to execute Set-TargetResource functionality with error message: Exc
eption calling "CreateProcessAsUser" with "6" argument(s): "Could not create process. Error code:193" " was thrown from C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\M
SFT_xWindowsProcess.Integration.Tests.ps1:522 char:21
            + ...             Start-DscConfiguration -Path $configurationPath -ErrorAct ...
            +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
        523:                 } | Should -Not -Throw
        at <ScriptBlock>, C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1: line 513
      [+] Should start another process running 1.6s
WARNING: [WIN2019TEST1]:                            [] The GET operation will be carried against a pending configuration since the latest configuration has not converged yet.
      [+] Should be able to call Get-DscConfiguration without throwing 311ms
WARNING: [WIN2019TEST1]:                            [] The GET operation will be carried against a pending configuration since the latest configuration has not converged yet.
      [-] Should return the correct configuration 162ms
        Expected 2, but got 1.
        546:                 $currentConfig.ProcessCount | Should -Be 2
        at <ScriptBlock>, C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1: line 546
      [-] Should create a logfile 12ms
        Expected $true, but got $false.
        551:                 $pathResult | Should -Be $true
        at <ScriptBlock>, C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1: line 551

    Context Should stop all of the testProcess instances from running
      [-] Should have a logfile already present 9ms
        Expected $true, but got $false.
        561:                 $pathResult | Should -Be $true
        at <ScriptBlock>, C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1: line 561
      [-] Should not throw when removing the log file 37ms
        Expected no exception to be thrown, but an exception "Cannot find path 'C:\Has Spaces\xPSDesiredStateConfiguration\Tests\processTestLog.txt' because it does not exist." was t
hrown from C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1:565 char:19
            +                 { Remove-Item -Path $logFilePath } | Should -Not -Thr ...
            +                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
        565:                 { Remove-Item -Path $logFilePath } | Should -Not -Throw
        at <ScriptBlock>, C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration\MSFT_xWindowsProcess.Integration.Tests.ps1: line 565
      [+] Should compile without throwing 1.23s
      [+] Should be able to call Get-DscConfiguration without throwing 852ms
      [+] Should return the correct configuration 904ms
WARNING: There is no operation running currently. Stop will return without any action.
Tests completed in 57.6s
Tests Passed: 45, Failed: 18, Skipped: 0, Pending: 0, Inconclusive: 0 

PS C:\Has Spaces\xPSDesiredStateConfiguration\Tests\Integration> 

Suggested solution to the issue

TBD

The operating system the target node is running

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

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. in progress The issue is being actively worked on by someone. labels Mar 25, 2019
@kwirkykat kwirkykat removed the in progress The issue is being actively worked on by someone. label Apr 7, 2019
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.
Projects
None yet
2 participants