]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Test that 'rndc closelogs' works
authorMark Andrews <marka@isc.org>
Wed, 19 Jun 2024 00:43:49 +0000 (10:43 +1000)
committerMark Andrews <marka@isc.org>
Wed, 31 Jul 2024 07:36:38 +0000 (17:36 +1000)
bin/tests/system/logfileconfig/ns1/named.unlimited.in
bin/tests/system/logfileconfig/tests.sh

index f806eddd62e150d6c201c9b57e54761e683fb9aa..8cfd205e5b3c9d377b37584f4c0342562e093459 100644 (file)
@@ -37,7 +37,7 @@ logging {
        channel query_log {
          file "query_log";
          print-time yes;
-         buffered yes;
+         buffered no;
        };
        category queries { query_log; };
 };
index e738dbd66f496babf6242516a5eb18c28034ba4d..bc9eee962c6d0c966f63362e54bd3a0a2ea6e2c3 100644 (file)
@@ -28,6 +28,10 @@ test_with_retry() {
   return 1
 }
 
+rndccmd() (
+  "$RNDC" -c ../_common/rndc.conf -p "${CONTROLPORT}" -s "$@"
+)
+
 status=0
 n=0
 
@@ -276,6 +280,19 @@ test_with_retry -f ns1/named_unlimited.4 || ret=1
 if [ "$ret" -ne 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
+n=$((n + 1))
+echo_i "testing 'rndc closelogs' ($n)"
+ret=0
+test -f ns1/query_log || ret=1
+mv ns1/query_log ns1/query_log.1 || ret=1
+rndccmd 10.53.0.1 closelogs >rndc.out.test$n || ret=1
+$DIG version.bind txt ch @10.53.0.1 -p ${PORT} >dig.out.test$n || ret=1
+test -f ns1/query_log || ret=1
+lines=$(wc -l <"ns1/query_log")
+test ${lines:-0} -eq 1 || ret=1
+if [ "$ret" -ne 0 ]; then echo_i "failed"; fi
+status=$((status + ret))
+
 n=$((n + 1))
 echo_i "testing default logfile using named -L file ($n)"
 ret=0