]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
tests/packaging/interactive: added tests for configuration reload and renew docs-reload-force-pw716r/deployments/7718
authorAleš Mrázek <ales.mrazek@nic.cz>
Wed, 8 Oct 2025 19:17:46 +0000 (21:17 +0200)
committerAleš Mrázek <ales.mrazek@nic.cz>
Wed, 8 Oct 2025 19:40:57 +0000 (21:40 +0200)
tests/packaging/interactive/renew.sh [new file with mode: 0755]

diff --git a/tests/packaging/interactive/renew.sh b/tests/packaging/interactive/renew.sh
new file mode 100755 (executable)
index 0000000..dfde075
--- /dev/null
@@ -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