]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[rt40106] add tests for dig +[no]ttlunits
authorCurtis Blackburn <ckb@isc.org>
Thu, 10 Dec 2015 20:08:57 +0000 (12:08 -0800)
committerCurtis Blackburn <ckb@isc.org>
Thu, 10 Dec 2015 20:08:57 +0000 (12:08 -0800)
bin/tests/system/digdelv/ns2/example.db
bin/tests/system/digdelv/tests.sh

index 0a1aa5d61579bab9fa0d47b9ceacecc46dafef20..8cc8ba3f255efb35a488f0607eab5c00c4b66095 100644 (file)
@@ -48,3 +48,13 @@ dnskey                  300     DNSKEY  256 3 1 (
                                         b9VIE5x7KNHAYTvTO5d4S8M=
                                         )
 
+; TTL of 3 weeks
+weeks          1814400 A       10.53.0.2
+; TTL of 3 days
+days           259200  A       10.53.0.2
+; TTL of 3 hours
+hours          10800   A       10.53.0.2
+;TTL of 45 minutes
+minutes                2700    A       10.53.0.2
+;TTL of 45 seconds
+seconds                45      A       10.53.0.2
index 2b871691f7b99abeb58606ad7c486cd88b0947e7..e33b04c6584ea15c85ba18cfe85aad19bdea222f 100644 (file)
@@ -153,6 +153,33 @@ if [ -x ${DIG} ] ; then
   if [ $ret != 0 ]; then echo "I:failed"; fi
   status=`expr $status + $ret`
 
+  echo "I:checking dig +ttlunits works ($n)"
+  ret=0
+  $DIG $DIGOPTS +tcp @10.53.0.2 +ttlunits A weeks.example > dig.out.test$n || ret=1
+  grep "^weeks.example.                3w" < dig.out.test$n > /dev/null || ret=1
+  $DIG $DIGOPTS +tcp @10.53.0.2 +ttlunits A days.example > dig.out.test$n || ret=1
+  grep "^days.example.         3d" < dig.out.test$n > /dev/null || ret=1
+  $DIG $DIGOPTS +tcp @10.53.0.2 +ttlunits A hours.example > dig.out.test$n || ret=1
+  grep "^hours.example.                3h" < dig.out.test$n > /dev/null || ret=1
+  $DIG $DIGOPTS +tcp @10.53.0.2 +ttlunits A minutes.example > dig.out.test$n || ret=1
+  grep "^minutes.example.      45m" < dig.out.test$n > /dev/null || ret=1
+  $DIG $DIGOPTS +tcp @10.53.0.2 +ttlunits A seconds.example > dig.out.test$n || ret=1
+  grep "^seconds.example.      45s" < dig.out.test$n > /dev/null || ret=1
+  if [ $ret != 0 ]; then echo "I:failed"; fi
+  status=`expr $status + $ret`
+
+  n=`expr $n + 1`
+  echo "I:checking dig respects precedence of options with +ttlunits ($n)"
+  ret=0
+  $DIG $DIGOPTS +tcp @10.53.0.2 +ttlunits +nottlid A weeks.example > dig.out.test$n || ret=1
+  grep "^weeks.example.                IN" < dig.out.test$n > /dev/null || ret=1
+  $DIG $DIGOPTS +tcp @10.53.0.2 +nottlid +ttlunits A weeks.example > dig.out.test$n || ret=1
+  grep "^weeks.example.                3w" < dig.out.test$n > /dev/null || ret=1
+  $DIG $DIGOPTS +tcp @10.53.0.2 +nottlid +nottlunits A weeks.example > dig.out.test$n || ret=1
+  grep "^weeks.example.                1814400" < dig.out.test$n > /dev/null || ret=1
+  if [ $ret != 0 ]; then echo "I:failed"; fi
+  status=`expr $status + $ret`
+
 else
   echo "$DIG is needed, so skipping these dig tests"
 fi