mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-15 23:36:59 +00:00
tests: add alarming tests
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
08c9bcc502
commit
c0e7b50bd3
17 changed files with 152 additions and 0 deletions
|
|
@ -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
16
tests/alarm-critical
Executable 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
16
tests/alarm-critical-ranges
Executable 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
16
tests/alarm-critical-snets
Executable 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
16
tests/alarm-ok
Executable 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
16
tests/alarm-shared-ok
Executable 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
16
tests/alarm-warning
Executable 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
16
tests/alarm-warning-ranges
Executable 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
16
tests/alarm-warning-snets
Executable 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 $?
|
||||
2
tests/expected/alarm-critical
Normal file
2
tests/expected/alarm-critical
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
CRITICAL: dhcpd-pools: Ranges; crit: 1 warn: 0 ok: 4 Shared nets; crit: 1 warn: 0 ok: 1
|
||||
2
|
||||
2
tests/expected/alarm-critical-ranges
Normal file
2
tests/expected/alarm-critical-ranges
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
CRITICAL: dhcpd-pools: Ranges; crit: 1 warn: 0 ok: 4
|
||||
2
|
||||
2
tests/expected/alarm-critical-snets
Normal file
2
tests/expected/alarm-critical-snets
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
CRITICAL: dhcpd-pools: Shared nets; crit: 1 warn: 0 ok: 1
|
||||
2
|
||||
2
tests/expected/alarm-ok
Normal file
2
tests/expected/alarm-ok
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
OK: Ranges; crit: 0 warn: 0 ok: 5 Shared nets; crit: 0 warn: 0 ok: 2
|
||||
0
|
||||
2
tests/expected/alarm-shared-ok
Normal file
2
tests/expected/alarm-shared-ok
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
OK: Shared nets; crit: 0 warn: 0 ok: 2
|
||||
0
|
||||
2
tests/expected/alarm-warning
Normal file
2
tests/expected/alarm-warning
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
WARNING: dhcpd-pools: Ranges; crit: 0 warn: 1 ok: 4 Shared nets; crit: 0 warn: 1 ok: 1
|
||||
1
|
||||
2
tests/expected/alarm-warning-ranges
Normal file
2
tests/expected/alarm-warning-ranges
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
WARNING: dhcpd-pools: Ranges; crit: 0 warn: 1 ok: 4
|
||||
1
|
||||
2
tests/expected/alarm-warning-snets
Normal file
2
tests/expected/alarm-warning-snets
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
WARNING: dhcpd-pools: Shared nets; crit: 0 warn: 1 ok: 1
|
||||
1
|
||||
Loading…
Add table
Add a link
Reference in a new issue