diff options
Diffstat (limited to 'habitat/tests/test.pester.ps1')
-rw-r--r-- | habitat/tests/test.pester.ps1 | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/habitat/tests/test.pester.ps1 b/habitat/tests/test.pester.ps1 index a5f665c9de..56f31e9a2f 100644 --- a/habitat/tests/test.pester.ps1 +++ b/habitat/tests/test.pester.ps1 @@ -12,8 +12,21 @@ Describe "chef-infra-client" { $? | Should be $true } + <# + At some point hab's argument parsing changed and it started interpreting the trailing `--version` as being + an argument passed to hab instead of an argument to the command passed to `hab pkg exec`. + + Powershell 5.1 and 7 appear to differ in how they treat following arguments as well, such that these two + versions of the command fail in powershell 5.1 (which is currently what is running in the windows machines + in Buildkite) but pass in powershell 7 (which is currently what is running in a stock Windows 10 VM). + + $the_version = (hab pkg exec $PackageIdentifier chef-client.bat '--version' | Out-String).split(':')[1].Trim() + $the_version = (hab pkg exec $PackageIdentifier chef-client.bat --version | Out-String).split(':')[1].Trim() + + This version of the command passes in powershell 5.1 but fails in powershell 7. + #> It "is the expected version" { - $the_version = (hab pkg exec $PackageIdentifier chef-client.bat --version | Out-String).split(':')[1].Trim() + $the_version = (hab pkg exec $PackageIdentifier chef-client.bat -- --version | Out-String).split(':')[1].Trim() $the_version | Should be $PackageVersion } } @@ -52,4 +65,4 @@ Describe "chef-infra-client" { $? | Should be $true } } -}
\ No newline at end of file +} |