blob: c8cf993e2fec1489686f7757787c6cb2b20df6e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
param(
[Parameter()]
[string]$PackageIdentifier = $(throw "Usage: test.ps1 [test_pkg_ident] e.g. test.ps1 ci/user-windows-default/1.0.0/20190812103929")
)
$PackageVersion = $PackageIdentifier.split('/')[2]
Describe "chef-infra-client" {
Context "chef-client" {
It "is an executable" {
hab pkg exec $PackageIdentifier chef-client.bat --version
$? | 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 | Should be $PackageVersion
}
}
Context "ohai" {
It "is an executable" {
hab pkg exec $PackageIdentifier ohai.bat --version
$? | Should be $true
}
}
Context "chef-shell" {
It "is an executable" {
hab pkg exec $PackageIdentifier chef-shell.bat --version
$? | Should be $true
}
}
Context "chef-apply" {
It "is an executable" {
hab pkg exec $PackageIdentifier chef-apply.bat --version
$? | Should be $true
}
}
Context "chef-solo" {
It "is an executable" {
hab pkg exec $PackageIdentifier chef-solo.bat --version
$? | Should be $true
}
}
}
|