e56ad622c3
This extends the virsh-based test tooling to both the previous, basic example and the new "complete" example. It also removes the Vagrant tooling. Change-Id: I249f937e9b3eedc486e31a3d1c1ac31bcfdf0ca8
60 lines
1.4 KiB
Bash
Executable File
60 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR=$(realpath $(dirname $0))
|
|
export WORKSPACE=$(realpath ${SCRIPT_DIR}/..)
|
|
export GATE_UTILS=${WORKSPACE}/tools/g2/lib/all.sh
|
|
export TEMP_DIR=$(mktemp -d)
|
|
chmod -R 755 ${TEMP_DIR}
|
|
|
|
export GATE_COLOR=${GATE_COLOR:-1}
|
|
|
|
MANIFEST_ARG=${1:-resiliency}
|
|
export GATE_MANIFEST=${WORKSPACE}/tools/g2/manifests/${MANIFEST_ARG}.json
|
|
|
|
source ${GATE_UTILS}
|
|
|
|
STAGES_DIR=${WORKSPACE}/tools/g2/stages
|
|
|
|
log_temp_dir ${TEMP_DIR}
|
|
echo
|
|
|
|
STAGES=$(mktemp)
|
|
jq -cr '.stages | .[]' ${GATE_MANIFEST} > ${STAGES}
|
|
|
|
# NOTE(mark-burnett): It is necessary to use a non-stdin file descriptor for
|
|
# the read below, since we will be calling SSH, which will consume the
|
|
# remaining data on STDIN.
|
|
exec 3< $STAGES
|
|
while read -u 3 stage; do
|
|
NAME=$(echo ${stage} | jq -r .name)
|
|
STAGE_CMD=${STAGES_DIR}/$(echo ${stage} | jq -r .script)
|
|
|
|
if echo ${stage} | jq -e .arguments > /dev/null; then
|
|
ARGUMENTS=($(echo ${stage} | jq -r '.arguments[]'))
|
|
else
|
|
ARGUMENTS=
|
|
fi
|
|
|
|
log_stage_header "${NAME}"
|
|
if $STAGE_CMD ${ARGUMENTS[*]}; then
|
|
log_stage_success
|
|
else
|
|
log_color_reset
|
|
log_stage_error "${NAME}" ${LOG_FILE}
|
|
if echo ${stage} | jq -e .on_error > /dev/null; then
|
|
log_stage_diagnostic_header
|
|
ON_ERROR=${WORKSPACE}/$(echo ${stage} | jq -r .on_error)
|
|
set +e
|
|
$ON_ERROR
|
|
fi
|
|
exit 1
|
|
fi
|
|
log_stage_footer "${NAME}"
|
|
echo
|
|
done
|
|
|
|
echo
|
|
log_huge_success
|