mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +00:00
add digdelv +yaml system tests
This commit is contained in:
parent
617696fbfc
commit
33887dd941
@ -62,6 +62,11 @@ KEYID="$(cat ns2/keyid)"
|
||||
KEYDATA="$(< ns2/keydata sed -e 's/+/[+]/g')"
|
||||
NOSPLIT="$(< ns2/keydata sed -e 's/+/[+]/g' -e 's/ //g')"
|
||||
|
||||
HAS_PYYAML=0
|
||||
if [ -n "$PYTHON" ] ; then
|
||||
$PYTHON -c "import yaml" 2> /dev/null && HAS_PYYAML=1
|
||||
fi
|
||||
|
||||
if [ -x "$DIG" ] ; then
|
||||
n=$((n+1))
|
||||
echo_i "checking dig short form works ($n)"
|
||||
@ -716,6 +721,21 @@ if [ -x "$DIG" ] ; then
|
||||
grep '^fd92:7065:0b8e:ffff:0000:0000:0000:0002$' 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 "check dig +yaml output ($n)"
|
||||
ret=0
|
||||
dig_with_opts +qr +yaml @10.53.0.3 any ns2.example > dig.out.test$n 2>&1 || ret=1
|
||||
value=$($PYTHON yamlget.py dig.out.test$n 0 message query_message_data status || ret=1)
|
||||
[ "$value" = "NOERROR" ] || ret=1
|
||||
value=$($PYTHON yamlget.py dig.out.test$n 1 message response_message_data status || ret=1)
|
||||
[ "$value" = "NOERROR" ] || ret=1
|
||||
value=$($PYTHON yamlget.py dig.out.test$n 1 message response_message_data QUESTION_SECTION 0 || ret=1)
|
||||
[ "$value" = "ns2.example. IN ANY" ] || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
fi
|
||||
else
|
||||
echo_i "$DIG is needed, so skipping these dig tests"
|
||||
fi
|
||||
@ -744,6 +764,19 @@ if [ -x "$MDIG" ] ; then
|
||||
grep "; serial" < 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 "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
|
||||
value=$($PYTHON yamlget.py dig.out.test$n 0 message response_message_data status || ret=1)
|
||||
[ "$value" = "NOERROR" ] || ret=1
|
||||
value=$($PYTHON yamlget.py dig.out.test$n 0 message response_message_data QUESTION_SECTION 0 || ret=1)
|
||||
[ "$value" = "ns2.example. IN ANY" ] || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
fi
|
||||
else
|
||||
echo_i "$MDIG is needed, so skipping these mdig tests"
|
||||
fi
|
||||
@ -965,6 +998,22 @@ if [ -x "$DELV" ] ; then
|
||||
check_ttl_range delv.out.test$n SOA 300 || 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 delv +yaml output ($n)"
|
||||
ret=0
|
||||
delv_with_opts +yaml @10.53.0.3 any ns2.example > delv.out.test$n 2>&1 || ret=1
|
||||
value=$($PYTHON yamlget.py delv.out.test$n status || ret=1)
|
||||
[ "$value" = "success" ] || ret=1
|
||||
value=$($PYTHON yamlget.py delv.out.test$n query_name || ret=1)
|
||||
[ "$value" = "ns2.example" ] || ret=1
|
||||
value=$($PYTHON yamlget.py delv.out.test$n records 0 answer_not_validated 0 || ret=1)
|
||||
count=$(echo $value | wc -w )
|
||||
[ ${count:-0} -eq 5 ] || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status+ret))
|
||||
fi
|
||||
else
|
||||
echo_i "$DELV is needed, so skipping these delv tests"
|
||||
fi
|
||||
|
33
bin/tests/system/digdelv/yamlget.py
Normal file
33
bin/tests/system/digdelv/yamlget.py
Normal file
@ -0,0 +1,33 @@
|
||||
############################################################################
|
||||
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# 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 http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
############################################################################
|
||||
|
||||
try:
|
||||
import yaml
|
||||
except:
|
||||
print("No python yaml module, skipping")
|
||||
exit(1)
|
||||
|
||||
import subprocess
|
||||
import pprint
|
||||
import sys
|
||||
|
||||
f = open(sys.argv[1], "r")
|
||||
for item in yaml.safe_load_all(f):
|
||||
for key in sys.argv[2:]:
|
||||
try:
|
||||
key = int(key)
|
||||
except: pass
|
||||
try:
|
||||
item = item[key]
|
||||
except:
|
||||
print('error: index not found')
|
||||
exit(1)
|
||||
print (item)
|
@ -484,7 +484,6 @@ ret=0
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
|
||||
HAS_PYYAML=0
|
||||
if [ -n "$PYTHON" ] ; then
|
||||
$PYTHON -c "import yaml" 2> /dev/null && HAS_PYYAML=1
|
||||
|
@ -501,6 +501,7 @@
|
||||
./bin/tests/system/digdelv/prereq.sh SH 2018,2019
|
||||
./bin/tests/system/digdelv/setup.sh SH 2018,2019
|
||||
./bin/tests/system/digdelv/tests.sh SH 2015,2016,2017,2018,2019
|
||||
./bin/tests/system/digdelv/yamlget.py PYTHON 2019
|
||||
./bin/tests/system/ditch.pl PERL 2015,2016,2018,2019
|
||||
./bin/tests/system/dlz/clean.sh SH 2010,2012,2014,2016,2018,2019
|
||||
./bin/tests/system/dlz/ns1/dns-root/com/broken/dns.d/@/DNAME=10=example.net.= TXT.BRIEF 2015,2016,2018,2019
|
||||
|
Loading…
x
Reference in New Issue
Block a user