Commit be84e37dbe for bind
commit be84e37dbe690381fe89a40a0176960cd2d74ca4
Author: Martin Basti <mbasti@isc.org>
Date: Fri Oct 30 19:37:13 2026 +0000
Migrate dnstap roll checks to pytest and drop tests.sh
The "rndc dnstap -roll <N>" checks for ns3 (no versions) and ns2
(versions unlimited) join tests_dnstap.py as a parametrized test,
which issues the roll once and polls for the expected number of
files instead of repeating the roll itself.
This was the last part of the shell test, so tests.sh and its pytest
wrapper go away.
Assisted-by: Claude:claude-fable-5-1
diff --git a/bin/tests/system/dnstap/tests.sh b/bin/tests/system/dnstap/tests.sh
deleted file mode 100644
index ca650cc1c6..0000000000
--- a/bin/tests/system/dnstap/tests.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/sh
-
-# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-#
-# SPDX-License-Identifier: MPL-2.0
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, you can obtain one at https://mozilla.org/MPL/2.0/.
-#
-# See the COPYRIGHT file distributed with this work for additional
-# information regarding copyright ownership.
-
-set -e
-
-. ../conf.sh
-
-RNDCCMD="$RNDC -p ${CONTROLPORT} -c ../_common/rndc.conf"
-
-status=0
-
-echo_i "wait for servers to finish loading"
-ret=0
-wait_for_log 20 "all zones loaded" ns2/named.run || ret=1
-wait_for_log 20 "all zones loaded" ns3/named.run || ret=1
-if [ $ret != 0 ]; then echo_i "failed"; fi
-status=$((status + ret))
-
-_test_dnstap_roll() (
- ip="$1"
- ns="$2"
- n="$3"
-
- $RNDCCMD -s "${ip}" dnstap -roll "${n}" | sed "s/^/${ns} /" | cat_i \
- && files=$(find "$ns" -name "dnstap.out.[0-9]" | wc -l) \
- && test "$files" -eq "${n}" && test "$files" -ge "1" || return 1
-)
-
-test_dnstap_roll() {
- echo_i "checking 'rndc -roll $4' ($1)"
- ret=0
-
- try=0
- while test $try -lt 12; do
- touch "$3/dnstap.out.$try"
- try=$((try + 1))
- done
-
- _repeat 10 _test_dnstap_roll $2 $3 $4 || ret=1
- if [ $ret != 0 ]; then echo_i "failed"; fi
- status=$((status + ret))
-}
-
-test_dnstap_roll "no versions" 10.53.0.3 ns3 6
-test_dnstap_roll "no versions" 10.53.0.3 ns3 3
-test_dnstap_roll "no versions" 10.53.0.3 ns3 1
-
-test_dnstap_roll "versions" 10.53.0.2 ns2 6
-test_dnstap_roll "versions" 10.53.0.2 ns2 3
-test_dnstap_roll "versions" 10.53.0.2 ns2 1
-
-echo_i "exit status: $status"
-[ "$status" -eq 0 ] || exit 1
diff --git a/bin/tests/system/dnstap/tests_dnstap.py b/bin/tests/system/dnstap/tests_dnstap.py
index 0ec3754cd3..40cb511317 100644
--- a/bin/tests/system/dnstap/tests_dnstap.py
+++ b/bin/tests/system/dnstap/tests_dnstap.py
@@ -9,6 +9,9 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
+from pathlib import Path
+
+import glob
import os
import re
@@ -86,3 +89,25 @@ def test_large_answer():
message = frames[0]["message"]
assert message["response_message_data"]["opcode"] == "QUERY"
assert "opcode: QUERY" in message["response_message"]
+
+
+@pytest.mark.parametrize(
+ "ns",
+ [
+ pytest.param("ns3", id="default"),
+ pytest.param("ns2", id="unlimited"),
+ ],
+)
+@pytest.mark.parametrize("versions", [6, 3, 1])
+def test_roll(servers, ns, versions):
+ for i in range(12):
+ Path(f"{ns}/dnstap.out.{i}").touch()
+
+ servers[ns].rndc(f"dnstap -roll {versions}")
+
+ def check():
+ files = glob.glob(f"{ns}/dnstap.out.[0-9]")
+ assert len(files) == versions, sorted(files)
+ return True
+
+ isctest.run.retry_with_timeout(check, 10)
diff --git a/bin/tests/system/dnstap/tests_dnstap_unix.py b/bin/tests/system/dnstap/tests_dnstap_unix.py
index 9246236c41..e7e4f0603f 100644
--- a/bin/tests/system/dnstap/tests_dnstap_unix.py
+++ b/bin/tests/system/dnstap/tests_dnstap_unix.py
@@ -10,8 +10,7 @@
# information regarding copyright ownership.
"""
-Check the "rndc dnstap" commands: -reopen against a unix socket output read
-by fstrm_capture.
+Check the dnstap unix socket output of ns4, read by fstrm_capture.
"""
from dataclasses import dataclass
diff --git a/bin/tests/system/dnstap/tests_sh_dnstap.py b/bin/tests/system/dnstap/tests_sh_dnstap.py
deleted file mode 100644
index 6e60f2589c..0000000000
--- a/bin/tests/system/dnstap/tests_sh_dnstap.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-#
-# SPDX-License-Identifier: MPL-2.0
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, you can obtain one at https://mozilla.org/MPL/2.0/.
-#
-# See the COPYRIGHT file distributed with this work for additional
-# information regarding copyright ownership.
-
-import pytest
-
-import isctest.mark
-
-pytestmark = [
- isctest.mark.with_dnstap,
- pytest.mark.extra_artifacts(
- [
- "ns*/dnstap.out*",
- "ns2/example.db",
- ]
- ),
-]
-
-
-def test_dnstap(run_tests_sh):
- run_tests_sh()