]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
tests/packaging/interactive/reload.sh: improved test for reload and force reload
authorAleš Mrázek <ales.mrazek@nic.cz>
Tue, 7 Oct 2025 12:39:06 +0000 (14:39 +0200)
committerAleš Mrázek <ales.mrazek@nic.cz>
Wed, 8 Oct 2025 19:40:57 +0000 (21:40 +0200)
tests/packaging/interactive/reload.sh

index 85bca315b826631d38262de2417e5745d1bc35ef..6c3a1030ca38267ea3e5ea4b30cc176a5930812c 100755 (executable)
@@ -2,4 +2,27 @@
 
 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)
+
 kresctl reload
+sleep 6
+if [ $(count_errors) -ne $err_count ] || [ $(count_apply) -ne $rel_count ]; then
+    echo "Failed to reload."
+    exit 1
+fi
+
+kresctl reload --force
+sleep 6
+if [ $(count_errors) -ne $err_count ] || [ $(count_apply) -eq $rel_count ]; then
+    echo "Failed to force a reload."
+    exit 1
+fi