mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 15:57:00 +00:00
tests: add regression test to avoid shared-net off by one alarming issue
This tests ensures the problem fixed by Wolfgang Steudel cannot reoccur.
See the reference commit for details.
Reference: 5519763ba9
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
5519763ba9
commit
0705b0c17f
5 changed files with 187 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ TESTS = \
|
|||
tests/alarm-warning \
|
||||
tests/alarm-warning-ranges \
|
||||
tests/alarm-warning-snets \
|
||||
tests/shnet-alarm \
|
||||
tests/bootp \
|
||||
tests/complete \
|
||||
tests/empty \
|
||||
|
|
|
|||
31
tests/confs/shnet-alarm
Normal file
31
tests/confs/shnet-alarm
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
shared-network example1 {
|
||||
subnet 10.0.0.0 netmask 255.255.255.0 {
|
||||
pool {
|
||||
range 10.0.0.1 10.0.0.20;
|
||||
}
|
||||
}
|
||||
subnet 10.1.0.0 netmask 255.255.255.0 {
|
||||
pool {
|
||||
range 10.1.0.1 10.1.0.20;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
shared-network example2 {
|
||||
subnet 10.2.0.0 netmask 255.255.255.0 {
|
||||
pool {
|
||||
range 10.2.0.1 10.2.0.20;
|
||||
}
|
||||
}
|
||||
subnet 10.3.0.0 netmask 255.255.255.0 {
|
||||
pool {
|
||||
range 10.3.0.1 10.3.0.20;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
subnet 10.4.0.0 netmask 255.255.255.0 {
|
||||
pool {
|
||||
range 10.4.0.1 10.4.0.20;
|
||||
}
|
||||
}
|
||||
3
tests/expected/shnet-alarm
Normal file
3
tests/expected/shnet-alarm
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
CRITICAL: dhcpd-pools: Ranges - crit: 2 warn: 0 ok: 3; | range_crit=2 range_warn=0 range_ok=3
|
||||
Shared nets - crit: 1 warn: 0 ok: 1; | snet_crit=1 snet_warn=0 snet_ok=1
|
||||
2
|
||||
136
tests/leases/shnet-alarm
Normal file
136
tests/leases/shnet-alarm
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
lease 10.0.0.1 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:09;
|
||||
}
|
||||
|
||||
lease 10.1.0.1 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:00;
|
||||
}
|
||||
|
||||
lease 10.2.0.0 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:00;
|
||||
}
|
||||
lease 10.2.0.1 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:01;
|
||||
}
|
||||
lease 10.2.0.2 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:02;
|
||||
}
|
||||
lease 10.2.0.3 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:03;
|
||||
}
|
||||
lease 10.2.0.4 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:04;
|
||||
}
|
||||
lease 10.2.0.5 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:05;
|
||||
}
|
||||
|
||||
lease 10.3.0.0 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:00;
|
||||
}
|
||||
lease 10.3.0.1 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:01;
|
||||
}
|
||||
lease 10.3.0.2 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:02;
|
||||
}
|
||||
lease 10.3.0.3 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:03;
|
||||
}
|
||||
lease 10.3.0.4 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:04;
|
||||
}
|
||||
lease 10.3.0.5 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:05;
|
||||
}
|
||||
lease 10.3.0.6 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:06;
|
||||
}
|
||||
lease 10.3.0.7 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:07;
|
||||
}
|
||||
lease 10.3.0.8 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:08;
|
||||
}
|
||||
lease 10.3.0.9 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:09;
|
||||
}
|
||||
|
||||
lease 10.4.0.0 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:00;
|
||||
}
|
||||
lease 10.4.0.1 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:01;
|
||||
}
|
||||
lease 10.4.0.2 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:02;
|
||||
}
|
||||
lease 10.4.0.3 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:03;
|
||||
}
|
||||
lease 10.4.0.4 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:04;
|
||||
}
|
||||
lease 10.4.0.5 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:05;
|
||||
}
|
||||
lease 10.4.0.6 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:00;
|
||||
}
|
||||
lease 10.4.0.7 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:01;
|
||||
}
|
||||
lease 10.4.0.8 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:02;
|
||||
}
|
||||
lease 10.4.0.9 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:03;
|
||||
}
|
||||
lease 10.4.0.10 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:04;
|
||||
}
|
||||
lease 10.4.0.11 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:05;
|
||||
}
|
||||
lease 10.4.0.12 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:06;
|
||||
}
|
||||
lease 10.4.0.13 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:07;
|
||||
}
|
||||
lease 10.4.0.14 {
|
||||
binding state active;
|
||||
hardware ethernet 00:00:00:00:00:08;
|
||||
}
|
||||
16
tests/shnet-alarm
Executable file
16
tests/shnet-alarm
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 --critical=30 -c $top_srcdir/tests/confs/shnet-alarm \
|
||||
-l $top_srcdir/tests/leases/shnet-alarm -o tests/outputs/$IAM
|
||||
echo $? >> tests/outputs/$IAM
|
||||
|
||||
diff -u $top_srcdir/tests/expected/$IAM tests/outputs/$IAM
|
||||
exit $?
|
||||
Loading…
Add table
Add a link
Reference in a new issue