From: Aleš Mrázek Date: Wed, 8 Oct 2025 19:17:46 +0000 (+0200) Subject: tests/packaging/interactive: added tests for configuration reload and renew X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4d3721de57d9ce0189f9062a141a515f00544fe9;p=thirdparty%2Fknot-resolver.git tests/packaging/interactive: added tests for configuration reload and renew --- diff --git a/tests/packaging/interactive/renew.sh b/tests/packaging/interactive/renew.sh new file mode 100755 index 000000000..dfde0754b --- /dev/null +++ b/tests/packaging/interactive/renew.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +set -e + +function count_errors(){ + echo "$(journalctl -u knot-resolver.service | grep -c error)" +} + +function count_apply(){ + echo "$(journalctl -u knot-resolver.service | grep -c "Config applied successfully to all workers")" +} + +err_count=$(count_errors) +rel_count=$(count_apply) + +curl -X POST --unix-socket /run/knot-resolver/kres-api.sock http://api/renew +sleep 6 +if [ $(count_errors) -ne $err_count ] || [ $(count_apply) -ne $rel_count ]; then + echo "Failed to renew." + exit 1 +fi + +curl -X POST --unix-socket /run/knot-resolver/kres-api.sock http://api/renew/force +sleep 6 +if [ $(count_errors) -ne $err_count ] || [ $(count_apply) -eq $rel_count ]; then + echo "Failed to force a renew." + exit 1 +fi