
This is intended to address difficulties in setting up the existing Vagrant-based development environment, and provide a locally-runnable gate script. ./tools/gate.sh runs tests as specified by a JSON manifest. Valid manifests live in `tools/g2/manifests`. Currently, the following are supported: * full - Run an extensive suite. * genesis - Run only through Genesis. * quick - Run a small cluster test. * prepare - Run only the off-site preparation before Genesis -- useful for quick sanity testing. Change-Id: I4900d34437f9fe735f580ab91b38a6bb5424481e
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}
|
|
|
|
source ${GATE_UTILS}
|
|
|
|
MANIFEST_ARG=${1:-full}
|
|
MANIFEST=${WORKSPACE}/tools/g2/manifests/${MANIFEST_ARG}.json
|
|
|
|
STAGES_DIR=${WORKSPACE}/tools/g2/stages
|
|
|
|
log_temp_dir ${TEMP_DIR}
|
|
echo
|
|
|
|
STAGES=$(mktemp)
|
|
jq -cr '.stages | .[]' ${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}" ${TEMP_DIR}
|
|
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
|