summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2019-11-06 07:47:41 -0800
committerGitHub <noreply@github.com>2019-11-06 07:47:41 -0800
commitfb082398dfcc0bdcff2b6646d8d41e69d09ca8fa (patch)
tree0664a1e66b2cc4e2c264e8c0da83ad384e24aa19
parentaaa52a5d63711d2d0b38861eb8fd50c3fc21229f (diff)
parent62f1d3a350951eaeced91bd96c01a8b1039123a4 (diff)
downloadchef-fb082398dfcc0bdcff2b6646d8d41e69d09ca8fa.tar.gz
Merge pull request #9061 from chef/judicious-error-throwing
fix the habitat package promotion tests
-rw-r--r--.expeditor/habitat-test.pipeline.yml10
-rw-r--r--habitat/tests/spec.ps13
-rw-r--r--habitat/tests/test.ps13
-rw-r--r--scripts/ci/ensure-minimum-viable-hab.ps19
-rw-r--r--scripts/ci/verify-plan.ps113
5 files changed, 26 insertions, 12 deletions
diff --git a/.expeditor/habitat-test.pipeline.yml b/.expeditor/habitat-test.pipeline.yml
index f18957c653..8a71df9c17 100644
--- a/.expeditor/habitat-test.pipeline.yml
+++ b/.expeditor/habitat-test.pipeline.yml
@@ -1,8 +1,18 @@
---
+expeditor:
+ defaults:
+ buildkite:
+ timeout_in_minutes: 60
+ retry:
+ automatic:
+ limit: 1
+
steps:
- label: ":windows: Validate Habitat Builds of Chef Infra"
commands:
+ - powershell -File "./scripts/ci/ensure-minimum-viable-hab.ps1"
+ - 'Write-Host "--- :hammer_and_wrench: Installing $EXPEDITOR_PKG_IDENTS_CHEFINFRACLIENTX86_64WINDOWS"'
- hab pkg install "$EXPEDITOR_PKG_IDENTS_CHEFINFRACLIENTX86_64WINDOWS"
- powershell -File "./habitat/tests/test.ps1" -PackageIdentifier "$EXPEDITOR_PKG_IDENTS_CHEFINFRACLIENTX86_64WINDOWS"
expeditor:
diff --git a/habitat/tests/spec.ps1 b/habitat/tests/spec.ps1
index 5108b6d554..ab1656b221 100644
--- a/habitat/tests/spec.ps1
+++ b/habitat/tests/spec.ps1
@@ -9,9 +9,10 @@ winrm quickconfig -quiet
$chef_gem_root = (hab pkg exec $PackageIdentifier gem.cmd which chef | Split-Path | Split-Path)
try {
Push-Location $chef_gem_root
+ $env:PATH = "C:\hab\bin;$env:PATH"
hab pkg binlink --force $PackageIdentifier
/hab/bin/rspec --format progress --tag ~executables --tag ~choco_installed spec/functional
if (-not $?) { throw "functional testing failed"}
} finally {
Pop-Location
-} \ No newline at end of file
+}
diff --git a/habitat/tests/test.ps1 b/habitat/tests/test.ps1
index 4e28866657..640507428a 100644
--- a/habitat/tests/test.ps1
+++ b/habitat/tests/test.ps1
@@ -19,4 +19,5 @@ $test_result = Invoke-Pester -Strict -PassThru -Script @{
if ($test_result.FailedCount -ne 0) { Exit $test_result.FailedCount }
Write-Host "--- :alembic: Functional Tests"
-powershell -File "./habitat/tests/spec.ps1" -PackageIdentifier $PackageIdentifier \ No newline at end of file
+powershell -File "./habitat/tests/spec.ps1" -PackageIdentifier $PackageIdentifier
+if (-not $?) { throw "functional spec suite failed" }
diff --git a/scripts/ci/ensure-minimum-viable-hab.ps1 b/scripts/ci/ensure-minimum-viable-hab.ps1
new file mode 100644
index 0000000000..175c7d4890
--- /dev/null
+++ b/scripts/ci/ensure-minimum-viable-hab.ps1
@@ -0,0 +1,9 @@
+$hab_version = (hab --version)
+$hab_minor_version = $hab_version.split('.')[1]
+if ( -not $? -Or $hab_minor_version -lt 85 ) {
+ Write-Host "--- :habicat: Installing the version of Habitat required"
+ install-habitat --version 0.85.0.20190916
+ if (-not $?) { throw "Hab version is older than 0.85 and could not update it." }
+} else {
+ Write-Host "--- :habicat: :thumbsup: Minimum required version of Habitat already installed"
+}
diff --git a/scripts/ci/verify-plan.ps1 b/scripts/ci/verify-plan.ps1
index 880e5a3262..bf206fab9c 100644
--- a/scripts/ci/verify-plan.ps1
+++ b/scripts/ci/verify-plan.ps1
@@ -12,20 +12,12 @@ $Plan = 'chef-infra-client'
Write-Host "--- :8ball: :windows: Verifying $Plan"
-$hab_version = (hab --version)
-$hab_minor_version = $hab_version.split('.')[1]
-if ( -not $? -Or $hab_minor_version -lt 85 ) {
- Write-Host "--- :habicat: Installing the version of Habitat required"
- install-habitat --version 0.85.0.20190916
-} else {
- Write-Host "--- :habicat: :thumbsup: Minimum required version of Habitat already installed"
-}
-
+powershell -File "./scripts/ci/ensure-minimum-viable-hab.ps1"
+if (-not $?) { throw "Could not ensure the minimum hab version required is installed." }
Write-Host "--- :key: Generating fake origin key"
hab origin key generate $env:HAB_ORIGIN
-
$project_root = "$(git rev-parse --show-toplevel)"
Set-Location $project_root
@@ -42,3 +34,4 @@ if (-not $?) { throw "unable to install this build"}
Write-Host "--- :mag_right: Testing $Plan"
powershell -File "./habitat/tests/test.ps1" -PackageIdentifier $pkg_ident
+if (-not $?) { throw "package didn't pass the test suite" }