From 1638ab05fe4170d248fd99d3c91ac2a7bbda8e37 Mon Sep 17 00:00:00 2001 From: "Christopher A. Snapp" Date: Tue, 30 Jun 2020 10:37:19 -0600 Subject: 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 --- habitat/tests/test.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 habitat/tests/test.sh (limited to 'habitat/tests') 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' -- cgit v1.2.1