summaryrefslogtreecommitdiff
path: root/omnibus/omnibus-test.ps1
diff options
context:
space:
mode:
authorJeremiah Snapp <jeremiah@chef.io>2019-04-10 12:01:40 -0400
committerJeremiah Snapp <jeremiah@chef.io>2019-06-19 23:21:04 -0400
commit1541b80722ebe86f2934709c941983b6e8cc8dab (patch)
tree434acef496f12439020f3fc69f18893a57a09725 /omnibus/omnibus-test.ps1
parente4490790fb0e075c3d685dc245b258f929e64c73 (diff)
downloadchef-1541b80722ebe86f2934709c941983b6e8cc8dab.tar.gz
Improvements to omnibus buildkite pipelinesnappj/improve-omnibus-buildkite-pipeline
Enable all platforms in omnibus buildkite pipeline. Port appropriate functionality from ci/verify-chef.* scripts to the new omnibus/omnibus-test.* scripts. Signed-off-by: Jeremiah Snapp <jeremiah@chef.io>
Diffstat (limited to 'omnibus/omnibus-test.ps1')
-rw-r--r--omnibus/omnibus-test.ps182
1 files changed, 63 insertions, 19 deletions
diff --git a/omnibus/omnibus-test.ps1 b/omnibus/omnibus-test.ps1
index a0a0adadef..8e826cfb77 100644
--- a/omnibus/omnibus-test.ps1
+++ b/omnibus/omnibus-test.ps1
@@ -10,28 +10,72 @@ If ([string]::IsNullOrEmpty($product)) { $product = "chef" }
$version = "$Env:VERSION"
If ([string]::IsNullOrEmpty($version)) { $version = "latest" }
-Write-Output "--- Downloading $channel $product $version"
-$download_url = C:\opscode\omnibus-toolchain\embedded\bin\mixlib-install.bat download --url --channel "$channel" "$product" --version "$version"
-$package_file = "$Env:Temp\$(Split-Path -Path $download_url -Leaf)"
-Invoke-WebRequest -OutFile "$package_file" -Uri "$download_url"
-
-Write-Output "--- Checking that $package_file has been signed."
-If ((Get-AuthenticodeSignature "$package_file").Status -eq 'Valid') {
- Write-Output "Verified $package_file has been signed."
-}
-Else {
- Write-Output "Exiting with an error because $package_file has not been signed. Check your omnibus project config."
- exit 1
+Write-Output "--- Installing $channel $product $version"
+$package_file = $(C:\opscode\omnibus-toolchain\bin\install-omnibus-product.ps1 -Product "$product" -Channel "$channel" -Version "$version" | Select-Object -Last 1)
+
+Write-Output "--- Verifying omnibus package is signed"
+C:\opscode\omnibus-toolchain\bin\check-omnibus-package-signed.ps1 "$package_file"
+
+Write-Output "--- Running verification for $channel $product $version"
+
+# We don't want to add the embedded bin dir to the main PATH as this
+# could mask issues in our binstub shebangs.
+$embedded_bin_dir = "C:\opscode\$product\embedded\bin"
+
+# Set TEMP and TMP environment variables to a short path because buildkite-agent user's default path is so long it causes tests to fail
+$Env:TEMP = "C:\cheftest"
+$Env:TMP = "C:\cheftest"
+Remove-Item -Recurse -Force $Env:TEMP -ErrorAction SilentlyContinue
+New-Item -ItemType directory -Path $Env:TEMP
+
+ForEach ($b in
+ "chef-client",
+ "knife",
+ "chef-solo",
+ "ohai"
+) {
+ Write-Output "Checking for existence of binfile $b..."
+
+ If (Test-Path -PathType Leaf -Path "C:\opscode\$product\bin\$b") {
+ Write-Output "Found $b!"
+ }
+ Else {
+ Write-Output "Error: Could not find $b"
+ exit 1
+ }
}
-Write-Output "--- Installing $channel $product $version"
-Start-Process "$package_file" /quiet -Wait
+$Env:PATH = "C:\opscode\$product\bin;$Env:PATH"
+
+chef-client --version
+
+# Exercise various packaged tools to validate binstub shebangs
+& $embedded_bin_dir\ruby --version
+& $embedded_bin_dir\gem.bat --version
+& $embedded_bin_dir\bundle.bat --version
+& $embedded_bin_dir\rspec.bat --version
+
+$Env:PATH = "C:\opscode\$product\bin;C:\opscode\$product\embedded\bin;$Env:PATH"
+
+# Test against the vendored chef gem (cd into the output of "gem which chef")
+$chefdir = gem which chef
+$chefdir = Split-Path -Path "$chefdir" -Parent
+$chefdir = Split-Path -Path "$chefdir" -Parent
+Set-Location -Path $chefdir
+
+Get-Location
+
+# ffi-yajl must run in c-extension mode for perf, so force it so we don't accidentally fall back to ffi
+$Env:FORCE_FFI_YAJL = "ext"
-Write-Output "--- Testing $channel $product $version"
+# chocolatey functional tests fail so delete the chocolatey binary to avoid triggering them
+Remove-Item -Path C:\ProgramData\chocolatey\bin\choco.exe -ErrorAction SilentlyContinue
-$Env:PATH = "C:\opscode\chef\bin;${Env:PATH}"
-$Env:PROJECT_NAME = $product
+# some tests need winrm configured
+winrm quickconfig -quiet
-Write-Output "Running verification for $product"
+bundle
+If ($lastexitcode -ne 0) { Exit $lastexitcode }
-ci/verify-chef.bat
+bundle exec rspec -r rspec_junit_formatter -f RspecJunitFormatter -o test.xml -f documentation spec/functional
+If ($lastexitcode -ne 0) { Exit $lastexitcode }