From: Miod Vallat Date: Mon, 17 Feb 2025 14:16:15 +0000 (+0100) Subject: Add simple tests for pdnsutil add-record behaviour. X-Git-Tag: dnsdist-2.0.0-alpha1~44^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00f4a951ae6dd3e3181cb97ed5ca523ebb8c5d97;p=thirdparty%2Fpdns.git Add simple tests for pdnsutil add-record behaviour. --- diff --git a/regression-tests/tests/pdnsutil-zone-handling/command b/regression-tests/tests/pdnsutil-zone-handling/command new file mode 100755 index 0000000000..bd1b1545f8 --- /dev/null +++ b/regression-tests/tests/pdnsutil-zone-handling/command @@ -0,0 +1,39 @@ +#!/bin/sh + +# The first invocation of pdnsutil is redirected to /dev/null to hide the +# "local files have been created" message if using lmdb as backend. +# All other pdnsutil invocation have the Ueberbackend destructor messages from +# --enable-verbose-logging removed. +# Invocations which will output zone contents are passed through sort(1), as +# the order of entries for records having multiple entries is backend-specific +# and not guaranteed to be in any particular order. +$PDNSUTIL --config-dir=. --config-name=$backend \ + create-zone bug.less \ + > /dev/null 2>&1 +$PDNSUTIL --config-dir=. --config-name=$backend \ + add-record bug.less cname CNAME host \ + 2>&1 | grep -v Ueber +$PDNSUTIL --config-dir=. --config-name=$backend \ + add-record bug.less host A 127.0.0.1 \ + 2>&1 | grep -v Ueber +# Duplicate records should be omitted +$PDNSUTIL --config-dir=. --config-name=$backend \ + add-record bug.less host2 A 127.0.0.2 127.0.0.2 \ + 2>&1 | sort | grep -v Ueber +# Can't add non-CNAME record to a CNAME record +$PDNSUTIL --config-dir=. --config-name=$backend \ + add-record bug.less cname A 127.0.0.1 \ + 2>&1 | grep -v Ueber +# Can't add CNAME record if other records exist +$PDNSUTIL --config-dir=. --config-name=$backend \ + add-record bug.less host CNAME host2 \ + 2>&1 | grep -v Ueber +# Adding existing record should ignore duplicates +$PDNSUTIL --config-dir=. --config-name=$backend \ + add-record bug.less host2 A 127.0.0.2 127.0.0.3 \ + 2>&1 | sort | grep -v Ueber + +# Display zone contents for final verification +$PDNSUTIL --config-dir=. --config-name=$backend \ + list-zone bug.less \ + 2>&1 | sort | grep -v Ueber diff --git a/regression-tests/tests/pdnsutil-zone-handling/description b/regression-tests/tests/pdnsutil-zone-handling/description new file mode 100644 index 0000000000..2e6cbe81b7 --- /dev/null +++ b/regression-tests/tests/pdnsutil-zone-handling/description @@ -0,0 +1 @@ +This test checks various pdnsutil behaviour when editing zone contents. diff --git a/regression-tests/tests/pdnsutil-zone-handling/expected_result b/regression-tests/tests/pdnsutil-zone-handling/expected_result new file mode 100644 index 0000000000..7e188dfe02 --- /dev/null +++ b/regression-tests/tests/pdnsutil-zone-handling/expected_result @@ -0,0 +1,18 @@ +New rrset: +cname.bug.less. 3600 IN CNAME host +New rrset: +host.bug.less. 3600 IN A 127.0.0.1 +Ignoring duplicate record content "127.0.0.2" +New rrset: +host2.bug.less. 3600 IN A 127.0.0.2 +Attempting to add record to cname.bug.less which already has a CNAME record +Attempting to add CNAME to host.bug.less which already has existing records +New rrset: +host2.bug.less. 3600 IN A 127.0.0.2 +host2.bug.less. 3600 IN A 127.0.0.3 +$ORIGIN . +bug.less 3600 IN SOA a.misconfigured.dns.server.invalid hostmaster.bug.less 0 10800 3600 604800 3600 +cname.bug.less 3600 IN CNAME host. +host.bug.less 3600 IN A 127.0.0.1 +host2.bug.less 3600 IN A 127.0.0.2 +host2.bug.less 3600 IN A 127.0.0.3 diff --git a/regression-tests/tests/pdnsutil-zone-handling/skip.bind b/regression-tests/tests/pdnsutil-zone-handling/skip.bind new file mode 100644 index 0000000000..e69de29bb2 diff --git a/regression-tests/tests/pdnsutil-zone-handling/skip.geoip b/regression-tests/tests/pdnsutil-zone-handling/skip.geoip new file mode 100644 index 0000000000..e69de29bb2 diff --git a/regression-tests/tests/pdnsutil-zone-handling/skip.ldap-simple b/regression-tests/tests/pdnsutil-zone-handling/skip.ldap-simple new file mode 100644 index 0000000000..e69de29bb2 diff --git a/regression-tests/tests/pdnsutil-zone-handling/skip.ldap-strict b/regression-tests/tests/pdnsutil-zone-handling/skip.ldap-strict new file mode 100644 index 0000000000..e69de29bb2 diff --git a/regression-tests/tests/pdnsutil-zone-handling/skip.ldap-tree b/regression-tests/tests/pdnsutil-zone-handling/skip.ldap-tree new file mode 100644 index 0000000000..e69de29bb2 diff --git a/regression-tests/tests/pdnsutil-zone-handling/skip.tinydns b/regression-tests/tests/pdnsutil-zone-handling/skip.tinydns new file mode 100644 index 0000000000..e69de29bb2