Merge pull request #969 from erikwilson/enable-local-storage-check

Enable sonobuoy local-path-provisioner startup check
pull/973/head
Erik Wilson 5 years ago committed by GitHub
commit 579e5aed01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -5,7 +5,7 @@ set -xe
cd $(dirname $0)/.. cd $(dirname $0)/..
if [ -z "${K3S_IMAGE}" ]; then if [ -z "${K3S_IMAGE}" ]; then
echo "K3S_IMAGE environment variable should be defined" echo 'K3S_IMAGE environment variable should be defined'
exit 1 exit 1
fi fi
@ -38,7 +38,7 @@ export -f fetch-kubeconfig
wait-for-kubeconfig() { wait-for-kubeconfig() {
while ! fetch-kubeconfig; do while ! fetch-kubeconfig; do
echo "Waiting for kubeconfig to become available..." echo 'Waiting for kubeconfig to become available...'
sleep 5 sleep 5
done done
} }
@ -57,8 +57,8 @@ export -f count-ready-nodes
# --- # ---
wait-for-nodes() { wait-for-nodes() {
while [[ "$(count-ready-nodes)" != "2" ]]; do while [[ $(count-ready-nodes) -ne $1 ]]; do
echo "Waiting for nodes to be ready..." echo 'Waiting for nodes to be ready...'
sleep 5 sleep 5
done done
} }
@ -75,8 +75,8 @@ export -f pod-ready
# --- # ---
wait-for-services() { wait-for-services() {
for service in coredns; do for service in $@; do
while [[ "$(pod-ready ${service})" != "true" ]]; do while [[ "$(pod-ready ${service})" != 'true' ]]; do
echo "Waiting for service ${service} to be ready..." echo "Waiting for service ${service} to be ready..."
sleep 5 sleep 5
done done
@ -99,7 +99,7 @@ export -f dump-container-logs
# --- # ---
retrieve-sonobuoy-logs() { retrieve-sonobuoy-logs() {
if sonobuoy status | grep -q -E " +e2e +complete +passed +"; then if sonobuoy status | grep -q -E ' +e2e +complete +passed +'; then
status=passed status=passed
exit_code=0 exit_code=0
else else
@ -140,7 +140,7 @@ export -f sonobuoy-test
cleanup() { cleanup() {
exit_status=$? exit_status=$?
set +e set +e
echo "Cleaning up" echo 'Cleaning up'
trap - EXIT trap - EXIT
[ -n "$SONOBUOY_PID" ] && kill $SONOBUOY_PID 2>/dev/null [ -n "$SONOBUOY_PID" ] && kill $SONOBUOY_PID 2>/dev/null
if [ "${exit_status}" -ne "0" ]; then if [ "${exit_status}" -ne "0" ]; then
@ -158,7 +158,7 @@ K3S_PORT=$(timeout --foreground 5s bash -c get-port)
OUTPUT=$(pwd)/sonobuoy-output/${K3S_PORT} OUTPUT=$(pwd)/sonobuoy-output/${K3S_PORT}
LOGS=$(pwd)/logs/$$ LOGS=$(pwd)/logs/$$
E2E="${OUTPUT}/e2e" E2E="${OUTPUT}/e2e"
E2E_LOG="plugins/e2e/results/global/e2e.log" E2E_LOG='plugins/e2e/results/global/e2e.log'
RESULTS="${E2E}/${E2E_LOG}" RESULTS="${E2E}/${E2E_LOG}"
SECRET=random-$((100000 + RANDOM % 999999)) SECRET=random-$((100000 + RANDOM % 999999))
@ -192,13 +192,13 @@ echo "Started ${K3S_AGENT}"
# --- # ---
timeout --foreground 1m bash -c wait-for-nodes timeout --foreground 1m bash -c 'wait-for-nodes 2'
timeout --foreground 1m bash -c wait-for-services timeout --foreground 1m bash -c 'wait-for-services coredns local-path-provisioner'
if [ "$ARCH" = "arm" ]; then if [ "$ARCH" = 'arm' ]; then
echo "Aborting sonobuoy tests, images not available for $ARCH" echo "Aborting sonobuoy tests, images not available for $ARCH"
exit 0 exit 0
fi fi
echo "Starting sonobuoy tests" echo 'Starting sonobuoy tests'
sonobuoy-test "${@}" sonobuoy-test "${@}"

Loading…
Cancel
Save