debian: rework autopkgtests

Ditch the old non-working one and add 3 new ones to check:
- that zebra can talk to the kernel at least somewhat
- that SNMP and RPKI modules can be loaded
- that frr-reload.py works

This should catch most build environment SNAFUs.

Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
David Lamparter 2018-12-17 18:55:31 +01:00
parent 6b37587791
commit aaabb66e4a
5 changed files with 76 additions and 32 deletions

22
debian/tests/bgpd-snmp-rpki vendored Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
set -e
# enable bgpd with SNMP & RPKI modules
cat >> /etc/frr/daemons <<EOF
bgpd=yes
bgpd_options="-A 127.0.0.1 -Msnmp -Mrpki"
EOF
service frr restart
# check that it actually started
killall -0 watchfrr
killall -0 zebra
killall -0 bgpd
# just for debugging
vtysh -c 'show modules'
# ... and SNMP & RPKI should be loaded
vtysh -c 'show modules' | grep -q snmp
vtysh -c 'show modules' | grep -q rpki

12
debian/tests/control vendored
View File

@ -1,3 +1,11 @@
Tests: daemons
Tests: zebra-lo
Depends: frr
Restrictions: needs-root
Restrictions: needs-root, isolation-container
Tests: bgpd-snmp-rpki
Depends: frr, frr-snmp, frr-rpki-rtrlib
Restrictions: needs-root, isolation-container
Tests: py-frr-reload
Depends: frr, frr-pythontools
Restrictions: needs-root, isolation-container

30
debian/tests/daemons vendored
View File

@ -1,30 +0,0 @@
#!/bin/bash
#---------------
# Testing frr
#---------------
set -e
# modify config file to enable all daemons and copy config files
CONFIG_FILE=/etc/frr/daemons
DAEMONS=("zebra" "bgpd" "ospfd" "ospf6d" "ripd" "ripngd" "isisd" "pimd" "fabricd")
for daemon in "${DAEMONS[@]}"
do
sed -i -e "s/${daemon}=no/${daemon}=yes/g" $CONFIG_FILE
cp /usr/share/doc/frr/examples/${daemon}.conf.sample /etc/frr/${daemon}.conf
done
# reload frr
/etc/init.d/frr restart > /dev/null 2>&1
# check daemons
for daemon in "${DAEMONS[@]}"
do
echo -n "check $daemon - "
if pidof -x $daemon > /dev/null; then
echo "${daemon} OK"
else
echo "ERROR: ${daemon} IS NOT RUNNING"
exit 1
fi
done

28
debian/tests/py-frr-reload vendored Executable file
View File

@ -0,0 +1,28 @@
#!/bin/sh
set -e
# should have been started on install, but policy may have inhibited that
service frr restart
# these should be running by default
killall -0 watchfrr
killall -0 zebra
killall -0 staticd
# configure interactively, save to file
vtysh -c 'configure terminal' -c 'ip route 198.51.100.0/28 127.0.0.1'
vtysh -c 'show running-config' | grep -q 'ip route 198.51.100.0/28 127.0.0.1'
vtysh -c 'write memory'
grep -q 'ip route 198.51.100.0/28 127.0.0.1' /etc/frr/frr.conf
# configure in file, check interactively
sed -e '/^ip route 198.51.100.0\/28 127.0.0.1/ c ip route 198.51.100.64/28 127.0.0.1' \
-i /etc/frr/frr.conf
service frr reload
vtysh -c 'show running-config' | grep -q 'ip route 198.51.100.64/28 127.0.0.1'
if vtysh -c 'show running-config' | grep -q 'ip route 198.51.100.0/28 127.0.0.1'; then
exit 1
fi

16
debian/tests/zebra-lo vendored Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
set -e
# should have been started on install, but policy may have inhibited that
service frr status >/dev/null || service frr restart
# these should be running by default
killall -0 watchfrr
killall -0 zebra
killall -0 staticd
# check vtysh works at all
vtysh -c 'show version'
# check zebra is properly talking to the kernel
vtysh -c 'show interface lo' | grep -q LOOPBACK