From: Kees Monshouwer Date: Sat, 4 Jan 2014 00:44:49 +0000 (+0100) Subject: goracle backend presigned fix and regression tests X-Git-Tag: rec-3.6.0-rc1~272^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aac4f4454446f4edb1879503be9dd6fa2401835b;p=pdns goracle backend presigned fix and regression tests --- diff --git a/modules/goraclebackend/goraclebackend.cc b/modules/goraclebackend/goraclebackend.cc index a63df2862..39fc1d490 100644 --- a/modules/goraclebackend/goraclebackend.cc +++ b/modules/goraclebackend/goraclebackend.cc @@ -13,10 +13,10 @@ #include "soracle.hh" #include -gOracleBackend::gOracleBackend(const string &mode, const string &suffix) : GSQLBackend(mode,suffix) +gOracleBackend::gOracleBackend(const string &mode, const string &suffix) : GSQLBackend(mode, suffix) { try { - // set some envionment variables + // set Oracle envionment variables setenv("ORACLE_HOME", getArg("home").c_str(), 1); setenv("ORACLE_SID", getArg("sid").c_str(), 1); setenv("NLS_LANG", getArg("nls-lang").c_str(), 1); @@ -28,16 +28,23 @@ gOracleBackend::gOracleBackend(const string &mode, const string &suffix) : GSQL } catch (SSqlException &e) { - L< oracle.log || true echo "CREATE USER pdns IDENTIFIED BY pdns;" | sqlplus -S powerdns/powerdns >> oracle.log echo "GRANT CONNECT, RESOURCE TO pdns;" | sqlplus -S powerdns/powerdns >> oracle.log @@ -1132,6 +1131,71 @@ startslave () fi set -e sqlite3 pdns.sqlite31 ANALYZE; + elif [ ${presignedcontext:0:7} = goracle ] + then + context=${context}-presigned + echo "DROP USER pdns2 CASCADE;" | sqlplus -S powerdns/powerdns > oracle2.log || true + echo "CREATE USER pdns2 IDENTIFIED BY pdns;" | sqlplus -S powerdns/powerdns >> oracle2.log + echo "GRANT CONNECT, RESOURCE TO pdns2;" | sqlplus -S powerdns/powerdns >> oracle2.log + sqlplus -S pdns2/pdns@xe < ../modules/goraclebackend/goracle-schema.sql >> oracle2.log + + cat > pdns-goracle2.conf << __EOF__ +launch=goracle +goracle-home=$ORACLE_HOME +goracle-sid=$ORACLE_SID +goracle-nls-lang=$NLS_LANG + +goracle-tnsname=xe +goracle-user=pdns2 +goracle-password=pdns +goracle-dnssec +__EOF__ + + for zone in $(grep zone named.conf | cut -f2 -d\" | tac) + do + echo "INSERT INTO domains (id, name, type, master) VALUES(domains_id_sequence.nextval, '$zone', 'SLAVE', '127.0.0.1:$port');" | sqlplus -S pdns2/pdns@xe >> oracle2.log + done + + set +e + echo $skipreasons | grep -q nodnssec + if [ $? -ne 0 ]; then + ../pdns/pdnssec --config-dir=. --config-name=goracle2 import-tsig-key test $ALGORITHM $KEY + ../pdns/pdnssec --config-dir=. --config-name=goracle2 activate-tsig-key tsig.com test master + echo $skipreasons | grep -q nolua + if [ $? -ne 0 ]; then + ../pdns/pdnssec --config-dir=. --config-name=goracle2 set-meta stest.com AXFR-SOURCE 127.0.0.2 + fi + fi + set -e + + port=$((port+100)) + + $RUNWRAPPER $PDNS2 --daemon=no --local-port=$port --config-dir=. \ + --config-name=goracle2 --socket-dir=./ --no-shuffle \ + --send-root-referral --slave --retrieval-threads=4 \ + --slave-cycle-interval=300 --config-name=goracle2 & + echo 'waiting for zones to be slaved' + + loopcount=0 + while [ $loopcount -lt 40 ] + do + sleep 5 + todo=$(sqlplus -S pdns2/pdns@xe << __EOF__ +set pagesize 0 feedback off verify off heading off echo off; +SELECT COUNT(id) FROM domains WHERE last_check IS NULL; +exit; +__EOF__ +) + if [ $todo = 0 ] + then + break + fi + let loopcount=loopcount+1 + done + if [ $todo -ne 0 ]; then + echo "AXFR FAILED" >> failed_tests + fi + elif [ ${presignedcontext:0:4} = bind ] then context=${context}-presigned