Enhance the test workflow scripts

This makes it so that tests can now:
1. Add additional values files to the test
2. That the post-install.sh script knows if the test passed or failed
   for better output
3. That the main test can be skipped in favor of a test provided one

Signed-off-by: Kevin Fox <[email protected]>
This commit is contained in:
Kevin Fox
2023-03-10 08:46:27 +01:00
committed by Marco Franssen
parent 9e22d2c303
commit 490fe8f543
+12 -6
View File
@@ -153,17 +153,23 @@ jobs:
- name: Run chart-testing (install)
run: |
export scenario="$(basename "${TEST_DIR}")"
export EXTRA_HELM_ARGS=""
[ "${scenario}" != "default" ] && kubectl create namespace "${scenario}"
post-install() {
[ -x "${TEST_DIR}/post-install.sh" ] && "${TEST_DIR}/post-install.sh"
[ -x "${TEST_DIR}/post-install.sh" ] && "${TEST_DIR}/post-install.sh" $1
exit $1
}
trap 'post-install $? $LINENO' EXIT
[ -x "${TEST_DIR}/pre-install.sh" ] && "${TEST_DIR}/pre-install.sh"
ct install --debug \
--namespace "${scenario}" \
--target-branch ${{ github.base_ref }} \
--exclude-deprecated \
${{ (matrix.values != 'default' && '--helm-extra-set-args "--values=${TEST_DIR}/values.yaml"') || '' }}
[ -f "${TEST_DIR}/.env" ] && source "${TEST_DIR}/.env"
if [ -x {${TEST_DIR}/install.sh ]; then
./${TEST_DIR}/install.sh
else
ct install --debug \
--namespace "${scenario}" \
--target-branch ${{ github.base_ref }} \
--exclude-deprecated \
${{ (matrix.values != 'default' && '--helm-extra-set-args "--values=${TEST_DIR}/values.yaml ${EXTRA_HELM_ARGS}"') || '' }}
fi
env:
TEST_DIR: .github/tests/${{ matrix.values }}