summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.expeditor/verify.habitat.pipeline.yml19
-rw-r--r--habitat/tests/spec.ps117
-rw-r--r--habitat/tests/test.pester.ps155
-rw-r--r--habitat/tests/test.ps122
-rw-r--r--scripts/ci/verify-plan.ps137
5 files changed, 150 insertions, 0 deletions
diff --git a/.expeditor/verify.habitat.pipeline.yml b/.expeditor/verify.habitat.pipeline.yml
index ed97d539c0..9c50312db5 100644
--- a/.expeditor/verify.habitat.pipeline.yml
+++ b/.expeditor/verify.habitat.pipeline.yml
@@ -1 +1,20 @@
---
+expeditor:
+ defaults:
+ buildkite:
+ timeout_in_minutes: 60
+ retry:
+ automatic:
+ limit: 1
+
+steps:
+
+- label: "Windows plan"
+ commands:
+ - scripts/ci/verify-plan.ps1
+ expeditor:
+ executor:
+ windows:
+ privileged: true
+ single-use: true
+ shell: ["powershell", "-Command"]
diff --git a/habitat/tests/spec.ps1 b/habitat/tests/spec.ps1
new file mode 100644
index 0000000000..5108b6d554
--- /dev/null
+++ b/habitat/tests/spec.ps1
@@ -0,0 +1,17 @@
+param (
+ [Parameter()]
+ [string]$PackageIdentifier = $(throw "Usage: test.ps1 [test_pkg_ident] e.g. test.ps1 ci/user-windows/1.0.0/20190812103929")
+)
+
+# some of the functional tests require that winrm be configured
+winrm quickconfig -quiet
+
+$chef_gem_root = (hab pkg exec $PackageIdentifier gem.cmd which chef | Split-Path | Split-Path)
+try {
+ Push-Location $chef_gem_root
+ 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.pester.ps1 b/habitat/tests/test.pester.ps1
new file mode 100644
index 0000000000..a5f665c9de
--- /dev/null
+++ b/habitat/tests/test.pester.ps1
@@ -0,0 +1,55 @@
+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
+ }
+
+ 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 "knife" {
+ It "is an executable" {
+ hab pkg exec $PackageIdentifier knife.bat --version
+ $? | Should be $true
+ }
+ }
+
+ Context "chef-solo" {
+ It "is an executable" {
+ hab pkg exec $PackageIdentifier chef-solo.bat --version
+ $? | Should be $true
+ }
+ }
+} \ No newline at end of file
diff --git a/habitat/tests/test.ps1 b/habitat/tests/test.ps1
new file mode 100644
index 0000000000..4e28866657
--- /dev/null
+++ b/habitat/tests/test.ps1
@@ -0,0 +1,22 @@
+param (
+ [Parameter()]
+ [string]$PackageIdentifier = $(throw "Usage: test.ps1 [test_pkg_ident] e.g. test.ps1 ci/user-windows/1.0.0/20190812103929")
+)
+
+# ensure Pester is available for test use
+if (-Not (Get-Module -ListAvailable -Name Pester)){
+ hab pkg install core/pester
+ Import-Module "$(hab pkg path core/pester)\module\pester.psd1"
+}
+
+Write-Host "--- :fire: Smokish Pestering"
+# Pester the Package
+$__dir=(Get-Item $PSScriptRoot)
+$test_result = Invoke-Pester -Strict -PassThru -Script @{
+ Path = "$__dir/test.pester.ps1";
+ Parameters = @{PackageIdentifier=$PackageIdentifier}
+}
+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
diff --git a/scripts/ci/verify-plan.ps1 b/scripts/ci/verify-plan.ps1
new file mode 100644
index 0000000000..de711cf542
--- /dev/null
+++ b/scripts/ci/verify-plan.ps1
@@ -0,0 +1,37 @@
+#!/usr/bin/env powershell
+
+#Requires -Version 5
+
+param(
+ # The name of the plan that is to be built.
+ [string]$Plan
+)
+
+$env:HAB_ORIGIN = 'ci'
+$Plan = 'chef-infra-client'
+
+Write-Host "--- :8ball: :windows: Verifying $Plan"
+
+Write-Host "--- :habicat: Installing the version of Habitat required"
+Install-Habitat --version 0.85.0.20190916
+
+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
+
+Write-Host "--- :construction: Building $Plan"
+$env:DO_CHECK=$true; hab pkg build .
+if (-not $?) { throw "unable to build"}
+
+. results/last_build.ps1
+if (-not $?) { throw "unable to determine details about this build"}
+
+Write-Host "--- :hammer_and_wrench: Installing $pkg_ident"
+hab pkg install results/$pkg_artifact
+if (-not $?) { throw "unable to install this build"}
+
+Write-Host "--- :mag_right: Testing $Plan"
+powershell -File "./habitat/tests/test.ps1" -PackageIdentifier $pkg_ident \ No newline at end of file