# #-- fast_reload_thread.test --#
# source the master var file when it's there
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
# use .tpkg.var.test for in test variable passing
[ -f .tpkg.var.test ] && source .tpkg.var.test

PRE="../.."
. ../common.sh

echo "> unbound-control status"
$PRE/unbound-control -c ub.conf status
if test $? -ne 0; then
	echo "wrong exit value."
	exit 1
else
	echo "exit value: OK"
fi

echo "> unbound-control fast_reload"
$PRE/unbound-control -c ub.conf fast_reload 2>&1 | tee output
if test $? -ne 0; then
	echo "wrong exit value."
	exit 1
else
	echo "exit value: OK"
fi
wait_logfile unbound.log "start fast reload thread" 60
wait_logfile unbound.log "stop fast reload thread" 60
wait_logfile unbound.log "joined with fastreload thread" 60

if grep "ok" output; then
	echo "OK"
else
	echo "output not correct"
	exit 1
fi

exit 0
