From a9d1cba46bd1e50f88483ee4af6f1c7593b14d57 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 13 Jun 2024 10:32:49 +1000 Subject: [PATCH] Add system tests for EDNS zoneversion --- bin/tests/system/digdelv/tests.sh | 58 +++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/bin/tests/system/digdelv/tests.sh b/bin/tests/system/digdelv/tests.sh index 9c7f42d730..6122fa1132 100644 --- a/bin/tests/system/digdelv/tests.sh +++ b/bin/tests/system/digdelv/tests.sh @@ -801,6 +801,64 @@ if [ -x "$DIG" ]; then if [ $ret -ne 0 ]; then echo_i "failed"; fi status=$((status + ret)) + n=$((n + 1)) + echo_i "checking dig +zoneversion to a authoritative server ($n)" + ret=0 + dig_with_opts @10.53.0.2 +zoneversion a.example >dig.out.test$n 2>&1 || ret=1 + pat="; ZONEVERSION: ZONE: example, SOA-SERIAL: 2000042407" + grep "$pat" dig.out.test$n >/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 "checking dig +yaml +zoneversion to a authoritative server ($n)" + ret=0 + dig_with_opts @10.53.0.2 +yaml +zoneversion a.example >dig.out.test$n 2>&1 || ret=1 + $PYTHON yamlget.py dig.out.test$n 0 message response_message_data OPT_PSEUDOSECTION EDNS ZONEVERSION >yamlget.out.test$n 2>&1 || ret=1 + read -r value to a authoritative server ($n)" + ret=0 + dig_with_opts @10.53.0.2 +ednsopt=ZONEVERSION:0100000007DA a.example >dig.out.test$n 2>&1 || ret=1 + grep "status: FORMERR" dig.out.test$n >/dev/null || ret=1 + grep "; ZONEVERSION:" 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 dig +zoneversion to a recursive server ($n)" + ret=0 + dig_with_opts @10.53.0.3 +zoneversion a.example >dig.out.test$n 2>&1 || ret=1 + grep '; ZONEVERSION:' 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 display of non serial type zoneversion ($n)" + ret=0 + dig_with_opts @10.53.0.2 +qr +ednsopt=ZONEVERSION:0100000007DA a.example >dig.out.test$n 2>&1 || ret=1 + grep '; ZONEVERSION: LABELS: 1, TYPE: 0, VALUE: 000007da ("....")' dig.out.test$n >/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 "checking display of non serial type zoneversion +yaml ($n)" + ret=0 + dig_with_opts @10.53.0.2 +qr +ednsopt=ZONEVERSION:0100000007DA a.example +yaml >dig.out.test$n 2>&1 || ret=1 + $PYTHON yamlget.py dig.out.test$n 0 message query_message_data OPT_PSEUDOSECTION EDNS ZONEVERSION >yamlget.out.test$n 2>&1 || ret=1 + expected="{'ZONE': 'example', 'TYPE': 1, 'VALUE': 000007da, PVALUE: '....'}" + if [ $ret -ne 0 ]; then echo_i "failed"; fi + status=$((status + ret)) + fi + n=$((n + 1)) echo_i "check that dig gracefully handles bad escape in domain name ($n)" ret=0