#!/usr/bin/env bash debug() { >&2 echo "DEBUG: $@" } error() { >&2 echo "ERROR: $@" exit 1 } install_charts() { pushd geosphere-grb/chart helm upgrade -v 2 --install --namespace $ns -f ../../ci_tests/values-grb-g16.yaml ${GRB_RELEASE_NAME} cspp-geo-grb/ popd } get_pod_name() { release_name="$1" kubectl -n $ns get pods --selector=app.kubernetes.io/instance=${release_name} -o name } run_grb_checks() { count=0 while true; do num_files=$(kubectl exec -n $ns ${GRB_POD_NAME} -c cspp-geo-grb-notifier -- ls -1 /dst | wc -l || echo 0) let count=count+1 if [[ $num_files -gt 16 ]]; then debug "Got at least 16 files" break fi if [[ $count -gt 10 ]]; then error "Took too long for GRB to produce files" fi sleep 10 done } set -e ns=$(./helpers/get_namespace.sh) source ci_tests/get_release_names.sh install_charts # give kubernetes a bit to create the pod sleep 30 debug "Getting GRB pod name" GRB_POD_NAME=$(get_pod_name "${GRB_RELEASE_NAME}") debug "GRB pod name: ${GRB_POD_NAME}" run_grb_checks || error "GRB checks failed"