From: Martin Basti Date: Wed, 22 Jul 2026 22:04:19 +0000 (+0000) Subject: Migrate digdelv mdig checks to pytest X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a189b1601cbb54267ca45b93511760d91d8f11c;p=thirdparty%2Fbind9.git Migrate digdelv mdig checks to pytest Move the mdig checks from tests.sh into a new tests_mdig.py module: the source address and port handling over TCP, the malformed '+ednsopt=:' option, the +multi +norrcomments output for DNSKEY and SOA, and the +yaml output structure. Like tests_dig.py, the module is skipped entirely when the mdig executable is not available. Assisted-by: Claude:claude-fable-5 --- diff --git a/bin/tests/system/digdelv/tests.sh b/bin/tests/system/digdelv/tests.sh index 6bf4eafdbbd..17c92096ac6 100644 --- a/bin/tests/system/digdelv/tests.sh +++ b/bin/tests/system/digdelv/tests.sh @@ -19,10 +19,6 @@ set -e status=0 n=0 -mdig_with_opts() { - "$MDIG" -p "$PORT" "$@" -} - # Check if response in file $1 has the correct TTL range. # The response record must have RRtype $2 and class IN (CLASS1). # Maximum TTL is given by $3. This works in most cases where TTL is @@ -63,63 +59,6 @@ NOSPLIT="$(sed /dev/null && HAS_PYYAML=1 -if [ -x "$MDIG" ]; then - n=$((n + 1)) - echo_i "checking mdig +tcp works with a source address and port ($n)" - ret=0 - # When running more than once in quick succession with a source address#port, - # we can get a "response failed with address not available" error because - # the address#port is still busy, but we are not interested in that error, - # as we are only looking for the unexpected error case, that's why we ignore - # the return code from mdig, but we check for the unexpected error message - # using grep. See GitLab #4969. - mdig_with_opts -b "10.53.0.3#${EXTRAPORT8}" +tcp @10.53.0.3 example >dig.out.test$n 2>&1 || true - grep -F "unexpected error" dig.out.test$n >/dev/null && ret=1 - if [ $ret -ne 0 ]; then echo_i "failed"; fi - status=$((status + ret)) - - n=$((n + 1)) - echo_i "check that mdig handles malformed option '+ednsopt=:' gracefully ($n)" - ret=0 - mdig_with_opts @10.53.0.3 +ednsopt=: a.example >dig.out.test$n 2>&1 && ret=1 - grep "ednsopt no code point specified" dig.out.test$n >/dev/null || ret=1 - if [ $ret -ne 0 ]; then echo_i "failed"; fi - status=$((status + ret)) - - n=$((n + 1)) - echo_i "checking mdig +multi +norrcomments works for DNSKEY (when default is rrcomments)($n)" - ret=0 - mdig_with_opts +tcp @10.53.0.3 +multi +norrcomments -t DNSKEY example >dig.out.test$n || ret=1 - grep "; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" dig.out.test$n && ret=1 - if [ $ret -ne 0 ]; then echo_i "failed"; fi - status=$((status + ret)) - - n=$((n + 1)) - echo_i "checking mdig +multi +norrcomments works for SOA (when default is rrcomments)($n)" - ret=0 - mdig_with_opts +tcp @10.53.0.3 +multi +norrcomments -t SOA example >dig.out.test$n || ret=1 - grep "; serial" /dev/null && ret=1 - if [ $ret -ne 0 ]; then echo_i "failed"; fi - status=$((status + ret)) - - if [ $HAS_PYYAML -ne 0 ]; then - n=$((n + 1)) - echo_i "check mdig +yaml output ($n)" - ret=0 - mdig_with_opts +yaml @10.53.0.3 -t any ns2.example >dig.out.test$n 2>&1 || ret=1 - $PYTHON yamlget.py dig.out.test$n 0 message response_message_data status >yamlget.out.test$n 2>&1 || ret=1 - read -r value yamlget.out.test$n 2>&1 || ret=1 - read -r value