]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add tests for "order none" RRset ordering rules
authorMichał Kępień <michal@isc.org>
Fri, 2 Oct 2020 06:41:43 +0000 (08:41 +0200)
committerMichał Kępień <michal@isc.org>
Fri, 2 Oct 2020 06:51:29 +0000 (08:51 +0200)
Make sure "order none" RRset ordering rules are tested in the
"rrsetorder" system test just like all other rule types are.  As the
check for the case of no "rrset-order" rule matching a given RRset also
tests "order none" (rather than "order random", as the test code may
suggest at first glance), replace the test code for that case so that it
matches other "order none" tests.

(cherry picked from commit abdd4c89fc7f4bf8f2eb502fa00e9d19f92bbdc5)

bin/tests/system/checkconf/good-rrset-order-none.conf [new file with mode: 0644]
bin/tests/system/rrsetorder/clean.sh
bin/tests/system/rrsetorder/ns1/named.conf.in
bin/tests/system/rrsetorder/ns1/root.db
bin/tests/system/rrsetorder/ns2/named.conf.in
bin/tests/system/rrsetorder/ns3/named.conf.in
bin/tests/system/rrsetorder/tests.sh

diff --git a/bin/tests/system/checkconf/good-rrset-order-none.conf b/bin/tests/system/checkconf/good-rrset-order-none.conf
new file mode 100644 (file)
index 0000000..afd0ab6
--- /dev/null
@@ -0,0 +1,5 @@
+options {
+       rrset-order {
+               order none;
+       };
+};
index ea90d8f67f8279438f13c43b21dbb68ca10d5c0c..97c025ae329a3ca0d3cd608c42a9bec065f22c07 100644 (file)
@@ -10,7 +10,7 @@
 # information regarding copyright ownership.
 
 rm -f dig.out.test*
-rm -f dig.out.cyclic dig.out.fixed dig.out.random dig.out.nomatch
+rm -f dig.out.cyclic dig.out.fixed dig.out.random dig.out.nomatch dig.out.none
 rm -f dig.out.0 dig.out.1 dig.out.2 dig.out.3
 rm -f dig.out.cyclic2
 rm -f ns2/root.bk
index 6e009f48353286710aaf4efa2a922482cad726ed..7e7170dbe7900eff2d0a74549efde03583c16a71 100644 (file)
@@ -24,6 +24,7 @@ options {
                name "fixed.example" order fixed;
                name "random.example" order random;
                name "cyclic.example" order cyclic;
+               name "none.example" order none;
                type NS order random;
                order cyclic;
        };
index b5a8f8f98272c2515a91e1c317195d05f1d99d12..2367f1025ff47a56af938e222608df9753664d99 100644 (file)
@@ -42,3 +42,8 @@ nomatch.example.      A       1.2.3.1
 nomatch.example.       A       1.2.3.2
 nomatch.example.       A       1.2.3.3
 nomatch.example.       A       1.2.3.4
+;
+none.example.          A       1.2.3.1
+none.example.          A       1.2.3.2
+none.example.          A       1.2.3.3
+none.example.          A       1.2.3.4
index 2f13d66c7178b4094cf777f8a736385541b63a91..998e07459ad103de71b8ea54423565a1c82d0cf3 100644 (file)
@@ -24,6 +24,7 @@ options {
                name "fixed.example" order fixed;
                name "random.example" order random;
                name "cyclic.example" order cyclic;
+               name "none.example" order none;
                type NS order random;
                order cyclic;
        };
index 7343a7e61881fa5c7cef8537a56562fdaf708e6a..1f3b54ac25667c24036430b136f32946ee8e1f7d 100644 (file)
@@ -24,6 +24,7 @@ options {
                name "fixed.example" order fixed;
                name "random.example" order random;
                name "cyclic.example" order cyclic;
+               name "none.example" order none;
                type NS order random;
                order cyclic;
        };
index 843e4266b6c25c68e59e2621adcb4226b965290e..2a93c2843f809aaac8c96cf05253a0c47606aaae 100644 (file)
@@ -143,6 +143,21 @@ if [ $match -lt `expr ${GOOD_RANDOM_NO} / 3` ]; then ret=1; fi
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+echo_i "Checking order none (primary)"
+ret=0
+# Fetch the "reference" response and ensure it contains the expected records.
+$DIGCMD @10.53.0.1 none.example > dig.out.none || ret=1
+for i in 1 2 3 4; do
+       grep -F -q 1.2.3.$i dig.out.none || ret=1
+done
+# Ensure 20 further queries result in the same response as the "reference" one.
+for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
+       $DIGCMD @10.53.0.1 none.example > dig.out.test$i || ret=1
+       $DIFF dig.out.none dig.out.test$i >/dev/null || ret=1
+done
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 #
 #
 #
@@ -237,6 +252,21 @@ if [ $match -lt `expr ${GOOD_RANDOM_NO} / 3` ]; then ret=1; fi
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+echo_i "Checking order none (secondary)"
+ret=0
+# Fetch the "reference" response and ensure it contains the expected records.
+$DIGCMD @10.53.0.2 none.example > dig.out.none || ret=1
+for i in 1 2 3 4; do
+       grep -F -q 1.2.3.$i dig.out.none || ret=1
+done
+# Ensure 20 further queries result in the same response as the "reference" one.
+for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
+       $DIGCMD @10.53.0.2 none.example > dig.out.test$i || ret=1
+       $DIFF dig.out.none dig.out.test$i >/dev/null || ret=1
+done
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 echo_i "Shutting down slave"
 
 (cd ..; $SHELL stop.sh rrsetorder ns2 )
@@ -347,6 +377,21 @@ if [ $match -lt `expr ${GOOD_RANDOM_NO} / 3` ]; then ret=1; fi
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+echo_i "Checking order none (secondary loaded from disk)"
+ret=0
+# Fetch the "reference" response and ensure it contains the expected records.
+$DIGCMD @10.53.0.2 none.example > dig.out.none || ret=1
+for i in 1 2 3 4; do
+       grep -F -q 1.2.3.$i dig.out.none || ret=1
+done
+# Ensure 20 further queries result in the same response as the "reference" one.
+for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
+       $DIGCMD @10.53.0.2 none.example > dig.out.test$i || ret=1
+       $DIFF dig.out.none dig.out.test$i >/dev/null || ret=1
+done
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 #
 #
 #
@@ -444,6 +489,21 @@ echo_i "Random selection return $match of ${GOOD_RANDOM_NO} possible orders in 3
 if [ $match -lt `expr ${GOOD_RANDOM_NO} / 3` ]; then ret=1; fi
 if [ $ret != 0 ]; then echo_i "failed"; fi
 
+echo_i "Checking order none (cache)"
+ret=0
+# Fetch the "reference" response and ensure it contains the expected records.
+$DIGCMD @10.53.0.3 none.example > dig.out.none || ret=1
+for i in 1 2 3 4; do
+       grep -F -q 1.2.3.$i dig.out.none || ret=1
+done
+# Ensure 20 further queries result in the same response as the "reference" one.
+for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
+       $DIGCMD @10.53.0.3 none.example > dig.out.test$i || ret=1
+       $DIFF dig.out.none dig.out.test$i >/dev/null || ret=1
+done
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 echo_i "Checking default order (cache)"
 ret=0
 for i in $GOOD_RANDOM
@@ -469,33 +529,22 @@ done
 echo_i "Default selection return $match of ${GOOD_RANDOM_NO} possible orders in 36 samples"
 if [ $match -lt `expr ${GOOD_RANDOM_NO} / 3` ]; then ret=1; fi
 if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
 
-echo_i "Checking default order no match in rrset-order (no shuffling)"
+echo_i "Checking default order no match in rrset-order (cache)"
 ret=0
-for i in $GOOD_RANDOM
-do
-       eval match$i=0
+# Fetch the "reference" response and ensure it contains the expected records.
+$DIGCMD @10.53.0.4 nomatch.example > dig.out.nomatch || ret=1
+for i in 1 2 3 4; do
+       grep -F -q 1.2.3.$i dig.out.nomatch || ret=1
 done
-for i in a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 9
-do
-$DIGCMD @10.53.0.4 nomatch.example > dig.out.nomatch|| ret=1
-       match=0
-       for j in $GOOD_RANDOM
-       do
-               eval "$DIFF dig.out.nomatch dig.out.random.good$j >/dev/null && match$j=1 match=1"
-               if [ $match -eq 1 ]; then break; fi
-       done
-       if [ $match -eq 0 ]; then ret=1; fi
-done
-match=0
-for i in $GOOD_RANDOM
-do
-eval "match=\`expr \$match + \$match$i\`"
+# Ensure 20 further queries result in the same response as the "reference" one.
+for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
+       $DIGCMD @10.53.0.4 nomatch.example > dig.out.test$i || ret=1
+       $DIFF dig.out.nomatch dig.out.test$i >/dev/null || ret=1
 done
-echo_i "Consistent selection return $match of ${GOOD_RANDOM_NO} possible orders in 36 samples"
-if [ $match -ne 1 ]; then ret=1; fi
 if [ $ret != 0 ]; then echo_i "failed"; fi
-
 status=`expr $status + $ret`
+
 echo_i "exit status: $status"
 [ $status -eq 0 ] || exit 1