]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add some (limited) zone variant awareness.
authorMiod Vallat <miod.vallat@powerdns.com>
Thu, 3 Jul 2025 14:29:03 +0000 (16:29 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Fri, 11 Jul 2025 08:16:11 +0000 (10:16 +0200)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
regression-tests/mysqldiff
regression-tests/tests/5dyndns-restore-zone/command
regression-tests/tests/pdnsutil-increase-serial-inception-epoch/command
regression-tests/tests/pdnsutil-increase-serial/command

index a51de96d0bc7b38abec5e56015f20c6a95977d9b..55f0a92fbff9bf80b7fef85f6024b6940dcc05c0 100755 (executable)
@@ -19,17 +19,26 @@ else
        SORT=sort
 fi
 
+plusvariant=''
+_context=${context%-variant}
+if [ $context != $_context ]
+then
+    plusvariant='..variant'
+fi
+zone=test.dyndns
+zonewithvariant=$zone$plusvariant
+
 case $backend in
 gmysql)
     if [ "${context: -9}" = "-nodnssec" ]
     then
        mysql --user="$GMYSQLUSER" --password="$GMYSQLPASSWD" --host="$GMYSQLHOST" \
                "$GMYSQLDB" \
-               -e "SELECT r.name, r.type, r.prio, r.content, r.ttl FROM domains d JOIN records r ON d.id=r.domain_id WHERE d.name='test.dyndns' AND(r.type != 'SOA' OR r.type IS NULL) ORDER BY r.name, r.type, r.content, r.ttl, r.prio" > ${testsdir}/${testname}/$step
+               -e "SELECT r.name, r.type, r.prio, r.content, r.ttl FROM domains d JOIN records r ON d.id=r.domain_id WHERE d.name='$zonewithvariant' AND(r.type != 'SOA' OR r.type IS NULL) ORDER BY r.name, r.type, r.content, r.ttl, r.prio" > ${testsdir}/${testname}/$step
     else
        mysql --user="$GMYSQLUSER" --password="$GMYSQLPASSWD" --host="$GMYSQLHOST" \
                "$GMYSQLDB" \
-               -e "SELECT r.name, r.type, r.prio, r.content, r.ttl, CONCAT('''', CONCAT(r.ordername, '''')), r.auth FROM domains d JOIN records r ON d.id=r.domain_id WHERE d.name='test.dyndns' AND(r.type != 'SOA' OR r.type IS NULL) ORDER BY r.name, r.type, r.content, r.ttl, r.prio" > ${testsdir}/${testname}/$step
+               -e "SELECT r.name, r.type, r.prio, r.content, r.ttl, CONCAT('''', CONCAT(r.ordername, '''')), r.auth FROM domains d JOIN records r ON d.id=r.domain_id WHERE d.name='$zonewithvariant' AND(r.type != 'SOA' OR r.type IS NULL) ORDER BY r.name, r.type, r.content, r.ttl, r.prio" > ${testsdir}/${testname}/$step
     fi
     ;;
 *)
@@ -38,7 +47,7 @@ gmysql)
     # Maybe we should add a pdnsutil backend-cmd to retrieve these results in
     # same format as the mysql query...
     $PDNSUTIL --config-dir=. --config-name=$backend \
-        list-zone test.dyndns | grep -vwF SOA | \
+        list-zone $zonewithvariant | grep -vwF SOA | \
         $SORT > ${testsdir}/${testname}/$step
     ;;
 esac
index 087cd6d0323cc42e8f230916d94df007b2d09033..54989fe523a684cbaadf24895e40ea9c5de1ee93 100755 (executable)
@@ -1,8 +1,16 @@
 #!/usr/bin/env bash
 
+plusvariant=''
+_context=${context%-variant}
+if [ $context != $_context ]
+then
+    plusvariant='..variant'
+fi
+
 for zone in test.dyndns sub.test.dyndns
 do
+    zonewithvariant=${zone}${plusvariant}
     $PDNSUTIL --config-dir=. --config-name=$backend \
-        replace-rrset ${zone} @ SOA "ns1.test.dyndns ahu.example.dyndns 2012060701 28800 7200 604800 86400" \
+        replace-rrset ${zonewithvariant} @ SOA "ns1.test.dyndns ahu.example.dyndns 2012060701 28800 7200 604800 86400" \
         > /dev/null
 done
index b45d5c0390a831980f490cabec0547e21ca3e310..ef2cee01548591c1e25fc269adc9c2cc4ac6b88c 100755 (executable)
@@ -1,19 +1,29 @@
 #!/usr/bin/env bash
 
+plusvariant=''
+_context=${context%-variant}
+if [ $context != $_context ]
+then
+    plusvariant='..variant'
+fi
+
+zone=test.dyndns
+zonewithvariant=${zone}${plusvariant}
+
 NOW=$(date +%s)
 
 # lower SOA so that the test makes sense
 $PDNSUTIL --config-dir=. --config-name=$backend \
-    replace-rrset test.dyndns @ SOA "ns1.test.dyndns ahu.example.dyndns 10 28800 7200 604800 86400" \
+    replace-rrset ${zonewithvariant} @ SOA "ns1.${zone} ahu.example.dyndns 10 28800 7200 604800 86400" \
     > /dev/null
 
-$PDNSUTIL --config-dir=. --config-name=$backend list-zone test.dyndns | grep SOA
+$PDNSUTIL --config-dir=. --config-name=$backend list-zone ${zonewithvariant} | grep SOA
 
-$PDNSUTIL --config-dir=. --config-name=$backend set-meta test.dyndns SOA-EDIT INCEPTION-EPOCH
+$PDNSUTIL --config-dir=. --config-name=$backend set-meta ${zonewithvariant} SOA-EDIT INCEPTION-EPOCH
 
-$PDNSUTIL --config-dir=. --config-name=$backend increase-serial test.dyndns > /dev/null
+$PDNSUTIL --config-dir=. --config-name=$backend increase-serial ${zonewithvariant} > /dev/null
 
-NEWSERIAL=$($PDNSUTIL --config-dir=. --config-name=$backend list-zone test.dyndns | grep SOA | awk '{print $7}')
+NEWSERIAL=$($PDNSUTIL --config-dir=. --config-name=$backend list-zone ${zonewithvariant} | grep SOA | awk '{print $7}')
 
 NOWPLUSTEN=$((NOW + 10))
 
@@ -25,9 +35,9 @@ else
 fi
 
 # remove meta
-$PDNSUTIL --config-dir=. --config-name=$backend set-meta test.dyndns SOA-EDIT
+$PDNSUTIL --config-dir=. --config-name=$backend set-meta ${zonewithvariant} SOA-EDIT
 
 # restore old SOA
 $PDNSUTIL --config-dir=. --config-name=$backend \
-    replace-rrset test.dyndns @ SOA "ns1.test.dyndns ahu.example.dyndns 2012060701 28800 7200 604800 86400" \
+    replace-rrset ${zonewithvariant} @ SOA "ns1.${zone} ahu.example.dyndns 2012060701 28800 7200 604800 86400" \
     > /dev/null
index 7814457e33d3b5c054dfe00a25336fb2535b6dc6..560906a029e68fdc68f204fe57ee28a57f901599 100755 (executable)
@@ -1,12 +1,22 @@
 #!/bin/sh
 
+plusvariant=''
+_context=${context%-variant}
+if [ $context != $_context ]
+then
+    plusvariant='..variant'
+fi
+
+zone=test.dyndns
+zonewithvariant=${zone}${plusvariant}
+
 mysqldiff
 
-$PDNSUTIL --config-dir=. --config-name=$backend increase-serial test.dyndns
+$PDNSUTIL --config-dir=. --config-name=$backend increase-serial ${zonewithvariant}
 
-mysqldiff 1 "Check that test.dyndns. still has a valid ordername"
+mysqldiff 1 "Check that ${zonewithvariant}. still has a valid ordername"
 
 # restore old SOA
 $PDNSUTIL --config-dir=. --config-name=$backend \
-    replace-rrset test.dyndns @ SOA "ns1.test.dyndns ahu.example.dyndns 2012060701 28800 7200 604800 86400" \
+    replace-rrset ${zonewithvariant} @ SOA "ns1.${zone} ahu.example.dyndns 2012060701 28800 7200 604800 86400" \
     > /dev/null