launch_local_testnet.sh: dump logs more often

This commit is contained in:
Ștefan Talpalaru 2020-05-02 00:09:04 +02:00
parent 11a36980a7
commit 1e7a4188d2
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
1 changed files with 12 additions and 6 deletions

View File

@ -150,6 +150,15 @@ cleanup() {
}
trap 'cleanup' SIGINT SIGTERM EXIT
dump_logs() {
LOG_LINES=20
for LOG in "${DATA_DIR}"/log*.txt; do
echo "Last ${LOG_LINES} lines of ${LOG}:"
tail -n ${LOG_LINES} "${LOG}"
echo "======"
done
}
PIDS=""
NODES_WITH_VALIDATORS=${NODES_WITH_VALIDATORS:-4}
VALIDATORS_PER_NODE=$(( $RANDOM_VALIDATORS / $NODES_WITH_VALIDATORS ))
@ -167,6 +176,7 @@ for NUM_NODE in $(seq 0 $(( ${NUM_NODES} - 1 ))); do
NOW_TIMESTAMP=$(date +%s)
if [[ "$(( NOW_TIMESTAMP - START_TIMESTAMP ))" -ge "$BOOTSTRAP_TIMEOUT" ]]; then
echo "Bootstrap node failed to start in ${BOOTSTRAP_TIMEOUT} seconds. Aborting."
dump_logs
exit 1
fi
done
@ -205,6 +215,7 @@ sleep 5
BG_JOBS="$(jobs | wc -l)"
if [[ "$BG_JOBS" != "$NUM_NODES" ]]; then
echo "$((NUM_NODES - BG_JOBS)) beacon_node instance(s) exited early. Aborting."
dump_logs
exit 1
fi
@ -218,12 +229,7 @@ else
done
if [[ "$FAILED" != "0" ]]; then
echo "${FAILED} child processes had non-zero exit codes (or exited early)."
LOG_LINES=20
for NUM_NODE in $(seq 0 $(( ${NUM_NODES} - 1 ))); do
echo "Last ${LOG_LINES} lines of ${DATA_DIR}/log${NUM_NODE}.txt:"
tail -n ${LOG_LINES} "${DATA_DIR}/log${NUM_NODE}.txt"
echo "======"
done
dump_logs
exit 1
fi
fi