k3s/scripts/sonobuoy-e2e-tests
2019-10-14 14:27:39 -07:00

56 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
set -e -x
cd $(dirname $0)/..
if [ -z "$K3S_IMAGE" ]; then
source $(dirname $0)/version.sh
TAG=${TAG:-${VERSION}${SUFFIX}}
REPO=${REPO:-rancher}
IMAGE_NAME=${IMAGE_NAME:-k3s}
export K3S_IMAGE=${REPO}/${IMAGE_NAME}:${TAG}
fi
OUTPUT=$(pwd)/dist/artifacts
mkdir -p ${OUTPUT}
pids=()
output=()
cleanup() {
exit_status=$?
set +e
trap - EXIT INT
kill ${pids[@]} 2>/dev/null
wait
set +x
echo -n "Tests "
if [ "${exit_status}" -eq "0" ]; then
echo "passed"
else
echo "failed"
fi
exit ${exit_status}
}
trap cleanup EXIT INT
run-sonobuoy() {
output+=(${log_output})
E2E_LOG_OUTPUT=${log_output} ./scripts/sonobuoy ${@} &
pids+=($!)
}
log_output=${OUTPUT}/e2e-STATUS-${ARCH}-parallel.log \
run-sonobuoy --e2e-focus='\[Conformance\]' --e2e-skip='\[Serial\]' --e2e-parallel=y
sleep 60
log_output=${OUTPUT}/e2e-STATUS-${ARCH}-serial.log \
run-sonobuoy --e2e-focus='\[Serial\].*\[Conformance\]'
exit_code=0
for pid in "${pids[@]}"; do
wait $pid || exit_code=$?
done
exit ${exit_code}