summaryrefslogtreecommitdiff
path: root/habitat/tests/test.pester.ps1
diff options
context:
space:
mode:
authorPete Higgins <pete@peterhiggins.org>2020-09-04 16:06:11 -0700
committerPete Higgins <pete@peterhiggins.org>2020-09-04 16:06:11 -0700
commit0466ec287d7f87d3974bf02aba613d0072c9bb7c (patch)
tree0dba4d6652e1dbb4b001b148766ac237d579c1df /habitat/tests/test.pester.ps1
parent90083e3ba82161d9f202f0d0c4bde4965c54b72f (diff)
downloadchef-0466ec287d7f87d3974bf02aba613d0072c9bb7c.tar.gz
Fix habitat argument passing in Windows test script.debug-windows-hab
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
Diffstat (limited to 'habitat/tests/test.pester.ps1')
-rw-r--r--habitat/tests/test.pester.ps117
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
+}