tame: TAME_DEBUG_RANDOM_NOACK: New environment variable to test runner ACK failures

When set, this will cause runner ACK failures to occur approximately every
1/N requests.  This allows manually testing conditions that would normally
only occur under severe resource contention.

DEV-10806
main
Mike Gerwitz 2023-10-03 16:09:20 -04:00
parent 3fad6c6375
commit 3d56fe289d
1 changed files with 12 additions and 0 deletions

View File

@ -351,6 +351,13 @@ verify-runner-ack()
{
local -r cmd="${1?Missing command}"
if [ -n "${TAME_DEBUG_RANDOM_NOACK:-}" ]; then
if [ $((RANDOM % ${TAME_DEBUG_RANDOM_NOACK:-1})) -eq 0 ]; then
echo "debug: TAME_DEBUG_RANDOM_NOACK triggered" >&2
return 2
fi
fi
read -t"$TAME_CMD_WAITTIME" -r ack || return
test "COMMAND $cmd" == "$ack" || {
# TODO check for ack mismatch once output race condition is fixed
@ -533,6 +540,11 @@ Environment Variables:
(see also --verbose)
TAME_CMD_WAITTIME number of seconds to wait for ack from
runner (default 3)
Debug Environment Variables:
TAME_DEBUG_RANDOM_NOACK randomly (1-in-N, where N is the value)
simulate a failed runner ACK to test
the runner restart system
EOF
exit $EX_USAGE