tests: add alarming tests

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2013-07-10 22:42:25 +01:00
parent 08c9bcc502
commit c0e7b50bd3
17 changed files with 152 additions and 0 deletions

View file

@ -1,4 +1,12 @@
TESTS = \
tests/alarm-critical \
tests/alarm-critical-ranges \
tests/alarm-critical-snets \
tests/alarm-ok \
tests/alarm-shared-ok \
tests/alarm-warning \
tests/alarm-warning-ranges \
tests/alarm-warning-snets \
tests/bootp \
tests/complete \
tests/empty \

16
tests/alarm-critical Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
#
# Alarm critical both ranges & shared nets.
IAM=$(basename $0)
if [ ! -d tests/outputs ]; then
mkdir tests/outputs
fi
dhcpd-pools --critical=50 -c $top_srcdir/tests/confs/complete \
-l $top_srcdir/tests/leases/complete -o tests/outputs/$IAM
echo $? >> tests/outputs/$IAM
diff -u $top_srcdir/tests/expected/$IAM tests/outputs/$IAM
exit $?

16
tests/alarm-critical-ranges Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
#
# Alarm critical ranges only.
IAM=$(basename $0)
if [ ! -d tests/outputs ]; then
mkdir tests/outputs
fi
dhcpd-pools -L 11 --critical=50 -c $top_srcdir/tests/confs/complete \
-l $top_srcdir/tests/leases/complete -o tests/outputs/$IAM
echo $? >> tests/outputs/$IAM
diff -u $top_srcdir/tests/expected/$IAM tests/outputs/$IAM
exit $?

16
tests/alarm-critical-snets Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
#
# Alarm critical shared networks only.
IAM=$(basename $0)
if [ ! -d tests/outputs ]; then
mkdir tests/outputs
fi
dhcpd-pools -L 22 --critical=50 -c $top_srcdir/tests/confs/complete \
-l $top_srcdir/tests/leases/complete -o tests/outputs/$IAM
echo $? >> tests/outputs/$IAM
diff -u $top_srcdir/tests/expected/$IAM tests/outputs/$IAM
exit $?

16
tests/alarm-ok Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
#
# Alarm warning both ranges and shared networks.
IAM=$(basename $0)
if [ ! -d tests/outputs ]; then
mkdir tests/outputs
fi
dhcpd-pools --critical=100 -c $top_srcdir/tests/confs/complete \
-l $top_srcdir/tests/leases/complete -o tests/outputs/$IAM
echo $? >> tests/outputs/$IAM
diff -u $top_srcdir/tests/expected/$IAM tests/outputs/$IAM
exit $?

16
tests/alarm-shared-ok Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
#
# Shared network should be OK, and critical range ignored.
IAM=$(basename $0)
if [ ! -d tests/outputs ]; then
mkdir tests/outputs
fi
dhcpd-pools -L 22 --critical=54 -c $top_srcdir/tests/confs/complete \
-l $top_srcdir/tests/leases/complete -o tests/outputs/$IAM
echo $? >> tests/outputs/$IAM
diff -u $top_srcdir/tests/expected/$IAM tests/outputs/$IAM
exit $?

16
tests/alarm-warning Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
#
# Alarm warning both ranges and shared networks.
IAM=$(basename $0)
if [ ! -d tests/outputs ]; then
mkdir tests/outputs
fi
dhcpd-pools --warning=50 -c $top_srcdir/tests/confs/complete \
-l $top_srcdir/tests/leases/complete -o tests/outputs/$IAM
echo $? >> tests/outputs/$IAM
diff -u $top_srcdir/tests/expected/$IAM tests/outputs/$IAM
exit $?

16
tests/alarm-warning-ranges Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
#
# Alarm warning ranges only.
IAM=$(basename $0)
if [ ! -d tests/outputs ]; then
mkdir tests/outputs
fi
dhcpd-pools -L 11 --warning=50 -c $top_srcdir/tests/confs/complete \
-l $top_srcdir/tests/leases/complete -o tests/outputs/$IAM
echo $? >> tests/outputs/$IAM
diff -u $top_srcdir/tests/expected/$IAM tests/outputs/$IAM
exit $?

16
tests/alarm-warning-snets Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
#
# Alarm warning shared networks only.
IAM=$(basename $0)
if [ ! -d tests/outputs ]; then
mkdir tests/outputs
fi
dhcpd-pools -L 22 --warning=50 -c $top_srcdir/tests/confs/complete \
-l $top_srcdir/tests/leases/complete -o tests/outputs/$IAM
echo $? >> tests/outputs/$IAM
diff -u $top_srcdir/tests/expected/$IAM tests/outputs/$IAM
exit $?

View file

@ -0,0 +1,2 @@
CRITICAL: dhcpd-pools: Ranges; crit: 1 warn: 0 ok: 4 Shared nets; crit: 1 warn: 0 ok: 1
2

View file

@ -0,0 +1,2 @@
CRITICAL: dhcpd-pools: Ranges; crit: 1 warn: 0 ok: 4
2

View file

@ -0,0 +1,2 @@
CRITICAL: dhcpd-pools: Shared nets; crit: 1 warn: 0 ok: 1
2

2
tests/expected/alarm-ok Normal file
View file

@ -0,0 +1,2 @@
OK: Ranges; crit: 0 warn: 0 ok: 5 Shared nets; crit: 0 warn: 0 ok: 2
0

View file

@ -0,0 +1,2 @@
OK: Shared nets; crit: 0 warn: 0 ok: 2
0

View file

@ -0,0 +1,2 @@
WARNING: dhcpd-pools: Ranges; crit: 0 warn: 1 ok: 4 Shared nets; crit: 0 warn: 1 ok: 1
1

View file

@ -0,0 +1,2 @@
WARNING: dhcpd-pools: Ranges; crit: 0 warn: 1 ok: 4
1

View file

@ -0,0 +1,2 @@
WARNING: dhcpd-pools: Shared nets; crit: 0 warn: 1 ok: 1
1