summaryrefslogtreecommitdiff
path: root/habitat/tests
diff options
context:
space:
mode:
authorChristopher A. Snapp <csnapp@chef.io>2020-06-30 10:37:19 -0600
committerChristopher A. Snapp <csnapp@chef.io>2020-07-13 13:33:47 -0600
commit1638ab05fe4170d248fd99d3c91ac2a7bbda8e37 (patch)
treeb11a3f29748fdb1879a27be9c4df102ab72cbdaf /habitat/tests
parenta555ea251f8f94df7093e87402187d3644aabdbe (diff)
downloadchef-1638ab05fe4170d248fd99d3c91ac2a7bbda8e37.tar.gz
Add windows + linux hab tests to verify pipeline
This removes the verify/habitat pipeline by bringing windows and linux verification tests into the default verify pipeline. Signed-off-by: Christopher A. Snapp <csnapp@chef.io>
Diffstat (limited to 'habitat/tests')
-rwxr-xr-xhabitat/tests/test.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/habitat/tests/test.sh b/habitat/tests/test.sh
new file mode 100755
index 0000000000..0882313c8e
--- /dev/null
+++ b/habitat/tests/test.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+export CHEF_LICENSE="accept-no-persist"
+export HAB_LICENSE="accept-no-persist"
+
+project_root="$(git rev-parse --show-toplevel)"
+pkg_ident="$1"
+
+# print error message followed by usage and exit
+error () {
+ local message="$1"
+
+ echo -e "\nERROR: ${message}\n" >&2
+
+ exit 1
+}
+
+[[ -n "$pkg_ident" ]] || error 'no hab package identity provided'
+
+package_version=$(awk -F / '{print $3}' <<<"$pkg_ident")
+
+cd "${project_root}"
+
+echo "--- :mag_right: Testing ${pkg_ident} executables"
+[[ "$package_version" = "$(hab pkg exec "${pkg_ident}" chef-client --version | sed 's/.*: //')" ]] || error "chef-client is not the expected version"
+
+for executable in 'chef-client' 'ohai' 'chef-shell' 'chef-apply' 'knife' 'chef-solo'; do
+ echo -en "\t$executable = "
+ hab pkg exec "${pkg_ident}" "${executable}" --version || error "${executable} failed to execute properly"
+done
+
+echo "--- :mag_right: Testing ${pkg_ident} functionality"
+hab pkg exec "${pkg_ident}" rspec -f documentation --tag ~executables spec/functional || error 'failures during rspec tests'