make it possible to run presigned tests against backend of choice or nsd
authorKees Monshouwer <mind04@monshouwer.org>
Sat, 14 Sep 2013 16:49:24 +0000 (18:49 +0200)
committermind04 <mind04@monshouwer.org>
Sat, 14 Sep 2013 22:44:44 +0000 (00:44 +0200)
regression-tests/.gitignore
regression-tests/named.conf
regression-tests/start-test-stop

index 6df8dbc81022d068b3207eddc497e05658280182..251a16a035ace1a9e37cbc599b05f39c71ddec7d 100644 (file)
@@ -29,7 +29,10 @@ real_result
 /Quantcast-Top-Million.txt
 /report.json
 /nsd.*
+/nsd-slave.*
 /*.nsd
+/ixfr-slave.db
+/ixfr-slave.state
 /*.signed
 /*.bind
 /dsset-*
index 8fc315b5fbafa0d0158302b6284d13b6f27f2c31..6a81965fc44ca1de3582a78419e78e0932b13903 100644 (file)
@@ -35,7 +35,6 @@ zone "nztest.com"{
        file "./nztest.com";
 };
 
-
 zone "dnssec-parent.com"{
        type master;
        file "./dnssec-parent.com";
@@ -57,6 +56,6 @@ zone "minimal.com"{
 };
 
 zone "tsig.com"{
-        type master;
-        file "./tsig.com";
+       type master;
+       file "./tsig.com";
 };
index 6ae7096e4cd378a37d1d182d7247524e529e5d9c..bc928a9df15c3aac889791504387ba2c1fc90a0a 100755 (executable)
@@ -300,7 +300,7 @@ remotebackend-pipe-dnssec remotebackend-unix-dnssec remotebackend-http-dnssec
 #remotebackend-pipe-nsec3-narrow remotebackend-unix-nsec3-narrow remotebackend-http-nsec3-narrow
 
 * Add -presigned to any ext-nsd, ext-bind, bind, gmysql or gsqlite3 test (except narrow)
-  to test presigned operation
+  to test presigned operation.
 
 * Add 'wait' (literally) after the context to not kill
   pdns_server immediately after testing. 'nowait' will kill it.
@@ -329,11 +329,15 @@ rm -f *_tests
 presigned=no
 both=no
 
-if [ "${context: -10}" = "-presigned" ]
+if [[ "$context" =~ .+-presigned.* ]]
 then
        presigned=yes
        port=$((port-100))
-       context=${context%-presigned}
+       eval "$(echo "$context" | sed -r 's/(.+)(-presigned)(-(.*))?/context=\1 presignedcontext=\4/')"
+       if [ -z "$presignedcontext" ]
+       then
+               presignedcontext=$context
+       fi
 fi
 
 if [ "${context: -5}" = "-both" ]
@@ -341,6 +345,7 @@ then
        both=yes
        port=$((port-100))
        context=${context%-both}
+       presignedcontext=$context
 fi
 
 optout=0
@@ -899,7 +904,7 @@ check_process
 startslave ()
 {
        skipreasons="$skipreasons presigned nodyndns"
-       if [ ${context:0:6} = gmysql ] || [ ${context:0:7} = ext-nsd ] || [ ${context:0:8} = ext-bind ]
+       if [ ${presignedcontext:0:6} = gmysql ] || [ ${presignedcontext:0:7} = ext-nsd ] || [ ${presignedcontext:0:8} = ext-bind ]
        then
                context=${context}-presigned
                [ -z "$GMYSQL2DB" ] && GMYSQL2DB=pdnstest2
@@ -960,7 +965,7 @@ startslave ()
                if [ $todo -ne 0 ]; then 
                        echo "AXFR FAILED" >> failed_tests
                fi
-       elif [ ${context:0:8} = gsqlite3 ]
+       elif [ ${presignedcontext:0:8} = gsqlite3 ]
        then
                context=${context}-presigned
                rm -f pdns.sqlite31
@@ -1009,7 +1014,7 @@ startslave ()
                fi
                set -e
                sqlite3 pdns.sqlite31 ANALYZE;
-       elif [ ${context:0:4} = bind ]
+       elif [ ${presignedcontext:0:4} = bind ]
        then
                context=${context}-presigned
                sed -e 's/type master;/type slave;\n\tmasters { 127.0.0.1:'$port'; };/' -e 's/file "\([^"]\+\)/file "\1-slave/' < named.conf > named-slave.conf
@@ -1040,6 +1045,55 @@ startslave ()
                        --cache-ttl=$cachettl --no-config --bind-dnssec-db=./dnssec-slave.sqlite3 &
                echo 'waiting for zones to be loaded'
                bindwait bind-slave
+       elif [ ${presignedcontext:0:3} = nsd ]
+       then
+               skipreasons="$skipreasons nsd"
+               context=nsd-presigned
+               cat > nsd-slave.conf << __EOF__
+server:
+       ip-address: 127.0.0.1@$((port+100))
+       database: ./nsd-slave.db
+       difffile: ./ixfr-slave.db
+       xfrdfile: ./ixfr-slave.state
+       zonesdir: .
+       username: ""
+
+key:
+       name: test
+       algorithm: $ALGORITHM
+       secret: "$KEY"
+__EOF__
+
+               rm -f ixfr-slave.db
+               rm -f ixfr-slave.state
+
+               for zone in $(grep zone named.conf  | cut -f2 -d\")
+               do
+                       rm -f $zone-slave
+
+                       echo "" >> nsd-slave.conf
+                       echo "zone:" >> nsd-slave.conf
+                       echo "  name: \"${zone}\"" >> nsd-slave.conf
+                       echo "  zonefile: \"${zone}-slave\"" >> nsd-slave.conf
+                       if [ "${zone}" = "tsig.com" ]
+                       then
+                               echo "  allow-notify: 127.0.0.1 test" >> nsd-slave.conf
+                               echo "  request-xfr: AXFR 127.0.0.1@$port test" >> nsd-slave.conf
+                               echo "  provide-xfr: 0.0.0.0/0 test" >> nsd-slave.conf
+                               echo "  provide-xfr: ::0/0 test" >> nsd-slave.conf
+                       else
+                               echo "  allow-notify: 127.0.0.1 NOKEY" >> nsd-slave.conf
+                               echo "  request-xfr: AXFR 127.0.0.1@$port NOKEY" >> nsd-slave.conf
+                               echo "  provide-xfr: 0.0.0.0/0 NOKEY" >> nsd-slave.conf
+                               echo "  provide-xfr: ::0/0 NOKEY" >> nsd-slave.conf
+                       fi
+               done
+
+               port=$((port+100))
+               nsdc -c nsd-slave.conf rebuild
+
+               nsd -c nsd-slave.conf -P pdns-slave.pid -d &
+               sleep 20
        fi
 }