Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lmdb regression tests to meson #14621

Merged
merged 11 commits into from
Oct 14, 2024
2 changes: 1 addition & 1 deletion build-scripts/test-recursor
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export PDNS=${PDNS:-"/usr/sbin/pdns_server"}
export PDNSUTIL=${PDNSUTIL:-"/usr/bin/pdnsutil"}
export SDIG=${SDIG:-"/usr/bin/sdig"}
export NSEC3DIG=${NSEC3DIG:-"/usr/bin/nsec3dig"}
export NOTIFY=${NOTIFY:-"/usr/bin/notify"}
export NOTIFY=${NOTIFY:-"/usr/bin/pdns_notify"}
export SAXFR=${SAXFR:-"/usr/bin/saxfr"}

if [ "$0" != "./build-scripts/test-recursor" ]; then
Expand Down
27 changes: 18 additions & 9 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -1093,14 +1093,23 @@ endif

if get_option('unit-tests-backends')
start_test_stop = files('regression-tests' / 'start-test-stop')[0]
endif

if get_option('module-geoip') != 'disabled' and get_option('unit-tests-backends')
test(
'pdns-auth-backend-geoip',
start_test_stop,
args: ['5300', 'geoip'],
workdir: product_source_dir / 'regression-tests',
depends: [pdns_auth],
)
test_modules = {
'geoip': 'module-geoip',
'lmdb': 'module-lmdb',
'lmdb-nodnssec': 'module-lmdb',
}

foreach module, option: test_modules
if get_option(option) != 'disabled'
test(
'pdns-auth-backend-' + module,
start_test_stop,
args: ['5300', module],
workdir: product_source_dir / 'regression-tests',
depends: [pdns_auth, pdns_auth_util, sdig, saxfr, pdns_auth_notify, nsec3dig],
is_parallel: false,
)
endif
endforeach
endif
8 changes: 4 additions & 4 deletions regression-tests.nobackend/rectify-axfr/command
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ sed '/directory/ { s@./zones@../regression-tests/zones@ }' ../regression-tests/n

cat >> ./named.conf << __EOF__
zone "."{
type primary;
file "../../regression-tests.rootzone/zones/ROOT";
type primary;
file "../../regression-tests.rootzone/zones/ROOT";
};
__EOF__

Expand All @@ -32,8 +32,8 @@ echo ANALYZE\; | sqlite3 pdns.sqlite3

for zone in $(grep 'zone ' named.conf | cut -f2 -d\")
do
$PDNSUTIL $ARGS set-nsec3 $zone "1 0 1 abcd" >&2
$PDNSUTIL $ARGS add-zone-key $zone rsasha256 1024 zsk active >&2
$PDNSUTIL $ARGS set-nsec3 $zone "1 0 1 abcd" >&2
$PDNSUTIL $ARGS add-zone-key $zone rsasha256 1024 zsk active >&2
done

$RUNWRAPPER $PDNS --daemon=no --local-port=$port --socket-dir=./ \
Expand Down
142 changes: 71 additions & 71 deletions regression-tests/backends/lmdb-slave
Original file line number Diff line number Diff line change
@@ -1,82 +1,82 @@
context=${context}-presigned-lmdb
cat > pdns-lmdb2.conf << __EOF__
context=${context}-presigned-lmdb
cat > pdns-lmdb2.conf << __EOF__
module-dir=./modules
launch=lmdb
lmdb-filename=./pdns2.lmdb
__EOF__

rm -f pdns2.lmdb*
zones=0
for zone in $(grep 'zone ' named.conf | cut -f2 -d\" | grep -v '^nztest.com$' | perl -e 'print reverse <STDIN>')
do
zones=$((zones+1))
if [ "$zone" = "example.com" ]; then
$PDNSUTIL --config-dir=. --config-name=lmdb2 create-secondary-zone $zone 127.0.0.1:$port
fi
if [ "$zone" = "test.com" ]; then
$PDNSUTIL --config-dir=. --config-name=lmdb2 create-secondary-zone $zone 127.0.0.1:$port
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-catalog $zone other-catalog.invalid
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-options-json $zone '{"consumer":{"coo":"catalog.invalid","unique":"42"}}'
fi
if [ "$zone" = "tsig.com" ]; then
$PDNSUTIL --config-dir=. --config-name=lmdb2 create-secondary-zone $zone 127.0.0.2:$port
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-catalog $zone catalog.invalid
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-options-json $zone "{\"consumer\":{\"unique\":\"$($SAXFR 127.0.0.1 $port catalog.invalid | grep $zone | grep PTR | cut -d'.' -f1)\"}}"
$PDNSUTIL --config-dir=. --config-name=lmdb2 import-tsig-key test $ALGORITHM $KEY
$PDNSUTIL --config-dir=. --config-name=lmdb2 activate-tsig-key tsig.com test secondary
fi
if [ "$zone" = "stest.com" ]; then
$PDNSUTIL --config-dir=. --config-name=lmdb2 create-secondary-zone $zone 127.0.0.1:$port
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-catalog $zone other-catalog.invalid
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-options-json $zone "{\"consumer\":{\"coo\":\"catalog.invalid\",\"unique\":\"$($SAXFR 127.0.0.1 $port catalog.invalid | grep $zone | grep PTR | cut -d'.' -f1)\"}}"
if [[ $skipreasons != *nolua* ]]; then
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-meta stest.com AXFR-SOURCE 127.0.0.2
fi
fi
if [ "$zone" = "wtest.com" ]; then
$PDNSUTIL --config-dir=. --config-name=lmdb2 create-secondary-zone $zone 127.0.0.1:$port
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-catalog $zone catalog.invalid
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-options-json $zone '{"consumer":{"unique":"42"}}'
fi
if [ "$zone" = "." ]; then
$PDNSUTIL --config-dir=. --config-name=lmdb2 create-secondary-zone $zone 127.0.0.1:$port
fi
done
rm -f pdns2.lmdb*
zones=0
for zone in $(grep 'zone ' named.conf | cut -f2 -d\" | grep -v '^nztest.com$' | perl -e 'print reverse <STDIN>')
do
zones=$((zones+1))
if [ "$zone" = "example.com" ]; then
$PDNSUTIL --config-dir=. --config-name=lmdb2 create-secondary-zone $zone 127.0.0.1:$port
fi
if [ "$zone" = "test.com" ]; then
$PDNSUTIL --config-dir=. --config-name=lmdb2 create-secondary-zone $zone 127.0.0.1:$port
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-catalog $zone other-catalog.invalid
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-options-json $zone '{"consumer":{"coo":"catalog.invalid","unique":"42"}}'
fi
if [ "$zone" = "tsig.com" ]; then
$PDNSUTIL --config-dir=. --config-name=lmdb2 create-secondary-zone $zone 127.0.0.2:$port
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-catalog $zone catalog.invalid
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-options-json $zone "{\"consumer\":{\"unique\":\"$($SAXFR 127.0.0.1 $port catalog.invalid | grep $zone | grep PTR | cut -d'.' -f1)\"}}"
$PDNSUTIL --config-dir=. --config-name=lmdb2 import-tsig-key test $ALGORITHM $KEY
$PDNSUTIL --config-dir=. --config-name=lmdb2 activate-tsig-key tsig.com test secondary
fi
if [ "$zone" = "stest.com" ]; then
$PDNSUTIL --config-dir=. --config-name=lmdb2 create-secondary-zone $zone 127.0.0.1:$port
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-catalog $zone other-catalog.invalid
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-options-json $zone "{\"consumer\":{\"coo\":\"catalog.invalid\",\"unique\":\"$($SAXFR 127.0.0.1 $port catalog.invalid | grep $zone | grep PTR | cut -d'.' -f1)\"}}"
if [[ $skipreasons != *nolua* ]]; then
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-meta stest.com AXFR-SOURCE 127.0.0.2
fi
fi
if [ "$zone" = "wtest.com" ]; then
$PDNSUTIL --config-dir=. --config-name=lmdb2 create-secondary-zone $zone 127.0.0.1:$port
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-catalog $zone catalog.invalid
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-options-json $zone '{"consumer":{"unique":"42"}}'
fi
if [ "$zone" = "." ]; then
$PDNSUTIL --config-dir=. --config-name=lmdb2 create-secondary-zone $zone 127.0.0.1:$port
fi
done

# setup catalog zone
if [ $zones -ne 1 ] # detect root tests
then
zones=$((zones+1))
$PDNSUTIL --config-dir=. --config-name=lmdb2 create-secondary-zone catalog.invalid 127.0.0.1:$port
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-kind catalog.invalid consumer
# setup catalog zone
if [ $zones -ne 1 ] # detect root tests
then
zones=$((zones+1))
$PDNSUTIL --config-dir=. --config-name=lmdb2 create-secondary-zone catalog.invalid 127.0.0.1:$port
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-kind catalog.invalid consumer

$PDNSUTIL --config-dir=. --config-name=lmdb2 create-secondary-zone remove.invalid 127.0.0.1:$port
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-catalog remove.invalid catalog.invalid
fi
$PDNSUTIL --config-dir=. --config-name=lmdb2 create-secondary-zone remove.invalid 127.0.0.1:$port
$PDNSUTIL --config-dir=. --config-name=lmdb2 set-catalog remove.invalid catalog.invalid
fi

port=$((port+100))
port=$((port+100))

$RUNWRAPPER $PDNS2 --daemon=no --local-port=$port --config-dir=. \
--config-name=lmdb2 --socket-dir=./ --no-shuffle \
--secondary --xfr-cycle-interval=15 --dname-processing --api --api-key=secret &
$RUNWRAPPER $PDNS2 --daemon=no --local-port=$port --config-dir=. \
--config-name=lmdb2 --socket-dir=./ --no-shuffle \
--secondary --xfr-cycle-interval=15 --dname-processing --api --api-key=secret &

sleep 1
$PDNSCONTROL --config-name=lmdb2 --socket-dir=. --no-config retrieve catalog.invalid
sleep 1
$PDNSCONTROL --config-name=lmdb2 --socket-dir=. --no-config retrieve catalog.invalid

echo 'waiting for zones to be fetched'
loopcount=0
while [ $loopcount -lt 30 ]
do
sleep 5
present=$(curl -s -S -H 'X-API-Key: secret' http://127.0.0.1:8081/api/v1/servers/localhost/zones | jq -r '.[] | .serial' | grep -c -v '^0$')
if [ $zones -eq $present ]
then
break
fi
let loopcount=loopcount+1
done
if [ $zones -ne $present ]
then
echo "AXFR FAILED" >> failed_tests
exit
fi
echo 'waiting for zones to be fetched'
loopcount=0
while [ $loopcount -lt 30 ]
do
sleep 5
present=$(curl -s -S -H 'X-API-Key: secret' http://127.0.0.1:8081/api/v1/servers/localhost/zones | jq -r '.[] | .serial' | grep -c -v '^0$')
if [ $zones -eq $present ]
then
break
fi
let loopcount=loopcount+1
done
if [ $zones -ne $present ]
then
echo "AXFR FAILED" >> failed_tests
exit
fi
Loading
Loading