mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 15:57:00 +00:00
tests: add mustach check
Use samples directory data as input to ensure they do not break. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
39e6e65201
commit
2ec953858b
3 changed files with 181 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ TESTS = \
|
||||||
tests/full-json \
|
tests/full-json \
|
||||||
tests/full-xml \
|
tests/full-xml \
|
||||||
tests/leading0 \
|
tests/leading0 \
|
||||||
|
tests/mustach \
|
||||||
tests/one-ip \
|
tests/one-ip \
|
||||||
tests/one-line \
|
tests/one-line \
|
||||||
tests/range4 \
|
tests/range4 \
|
||||||
|
|
|
||||||
161
tests/expected/mustach
Normal file
161
tests/expected/mustach
Normal file
|
|
@ -0,0 +1,161 @@
|
||||||
|
Subnets:
|
||||||
|
location: example1
|
||||||
|
range: 10.1.0.1 - 10.1.0.1
|
||||||
|
first_ip: 10.1.0.1
|
||||||
|
last_ip: 10.1.0.20
|
||||||
|
used: 10
|
||||||
|
touched: 0
|
||||||
|
defined: 20
|
||||||
|
free: 10
|
||||||
|
percent: 50
|
||||||
|
touch_count: 10
|
||||||
|
touch_percent: 50
|
||||||
|
backup_count: 0
|
||||||
|
backup_percent: 0
|
||||||
|
status: 0
|
||||||
|
|
||||||
|
location: example2
|
||||||
|
range: 10.2.0.1 - 10.2.0.1
|
||||||
|
first_ip: 10.2.0.1
|
||||||
|
last_ip: 10.2.0.20
|
||||||
|
used: 8
|
||||||
|
touched: 0
|
||||||
|
defined: 20
|
||||||
|
free: 12
|
||||||
|
percent: 40
|
||||||
|
touch_count: 8
|
||||||
|
touch_percent: 40
|
||||||
|
backup_count: 0
|
||||||
|
backup_percent: 0
|
||||||
|
status: 0
|
||||||
|
|
||||||
|
location: example2
|
||||||
|
range: 10.3.0.1 - 10.3.0.1
|
||||||
|
first_ip: 10.3.0.1
|
||||||
|
last_ip: 10.3.0.20
|
||||||
|
used: 9
|
||||||
|
touched: 0
|
||||||
|
defined: 20
|
||||||
|
free: 11
|
||||||
|
percent: 45
|
||||||
|
touch_count: 9
|
||||||
|
touch_percent: 45
|
||||||
|
backup_count: 0
|
||||||
|
backup_percent: 0
|
||||||
|
status: 0
|
||||||
|
|
||||||
|
location: All networks
|
||||||
|
range: 10.4.0.1 - 10.4.0.1
|
||||||
|
first_ip: 10.4.0.1
|
||||||
|
last_ip: 10.4.0.20
|
||||||
|
used: 5
|
||||||
|
touched: 0
|
||||||
|
defined: 20
|
||||||
|
free: 15
|
||||||
|
percent: 25
|
||||||
|
touch_count: 5
|
||||||
|
touch_percent: 25
|
||||||
|
backup_count: 1
|
||||||
|
backup_percent: 5
|
||||||
|
status: 0
|
||||||
|
|
||||||
|
|
||||||
|
Shared-networks:
|
||||||
|
location: example1
|
||||||
|
defined: 40
|
||||||
|
used: 21
|
||||||
|
touched: 0
|
||||||
|
free: 19
|
||||||
|
percent: 52.5
|
||||||
|
touch_count: 21
|
||||||
|
touch_percent: 52.5
|
||||||
|
backup_count: 1
|
||||||
|
backup_percent: 2.5
|
||||||
|
status: 0
|
||||||
|
|
||||||
|
location: example2
|
||||||
|
defined: 40
|
||||||
|
used: 17
|
||||||
|
touched: 0
|
||||||
|
free: 23
|
||||||
|
percent: 42.5
|
||||||
|
touch_count: 17
|
||||||
|
touch_percent: 42.5
|
||||||
|
backup_count: 0
|
||||||
|
backup_percent: 0
|
||||||
|
status: 0
|
||||||
|
|
||||||
|
|
||||||
|
Summary:
|
||||||
|
location: All networks
|
||||||
|
defined: 100
|
||||||
|
used: 43
|
||||||
|
touched: 0
|
||||||
|
free: 57
|
||||||
|
percent: 43
|
||||||
|
touch_count: 43
|
||||||
|
touch_percent: 43
|
||||||
|
backup_count: 3
|
||||||
|
backup_percent: 3
|
||||||
|
status: 0
|
||||||
|
|
||||||
|
--- skip ok ---
|
||||||
|
Subnets:
|
||||||
|
location: example1
|
||||||
|
range: 10.1.0.1 - 10.1.0.1
|
||||||
|
first_ip: 10.1.0.1
|
||||||
|
last_ip: 10.1.0.20
|
||||||
|
used: 10
|
||||||
|
touched: 0
|
||||||
|
defined: 20
|
||||||
|
free: 10
|
||||||
|
percent: 50
|
||||||
|
touch_count: 10
|
||||||
|
touch_percent: 50
|
||||||
|
backup_count: 0
|
||||||
|
backup_percent: 0
|
||||||
|
status: 1
|
||||||
|
|
||||||
|
location: example2
|
||||||
|
range: 10.3.0.1 - 10.3.0.1
|
||||||
|
first_ip: 10.3.0.1
|
||||||
|
last_ip: 10.3.0.20
|
||||||
|
used: 9
|
||||||
|
touched: 0
|
||||||
|
defined: 20
|
||||||
|
free: 11
|
||||||
|
percent: 45
|
||||||
|
touch_count: 9
|
||||||
|
touch_percent: 45
|
||||||
|
backup_count: 0
|
||||||
|
backup_percent: 0
|
||||||
|
status: 1
|
||||||
|
|
||||||
|
|
||||||
|
Shared-networks:
|
||||||
|
location: example1
|
||||||
|
defined: 40
|
||||||
|
used: 21
|
||||||
|
touched: 0
|
||||||
|
free: 19
|
||||||
|
percent: 52.5
|
||||||
|
touch_count: 21
|
||||||
|
touch_percent: 52.5
|
||||||
|
backup_count: 1
|
||||||
|
backup_percent: 2.5
|
||||||
|
status: 1
|
||||||
|
|
||||||
|
|
||||||
|
Summary:
|
||||||
|
location: All networks
|
||||||
|
defined: 100
|
||||||
|
used: 43
|
||||||
|
touched: 0
|
||||||
|
free: 57
|
||||||
|
percent: 43
|
||||||
|
touch_count: 43
|
||||||
|
touch_percent: 43
|
||||||
|
backup_count: 3
|
||||||
|
backup_percent: 3
|
||||||
|
status: 0
|
||||||
|
|
||||||
19
tests/mustach
Executable file
19
tests/mustach
Executable file
|
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Minimal regression test suite.
|
||||||
|
|
||||||
|
IAM=$(basename $0)
|
||||||
|
|
||||||
|
if [ ! -d tests/outputs ]; then
|
||||||
|
mkdir tests/outputs
|
||||||
|
fi
|
||||||
|
|
||||||
|
dhcpd-pools -c $top_srcdir/samples/dhcpd.conf -l $top_srcdir/samples/dhcpd.leases \
|
||||||
|
--mustach $top_srcdir/samples/mustach.template -o tests/outputs/$IAM
|
||||||
|
|
||||||
|
echo "--- skip ok ---" >> tests/outputs/$IAM
|
||||||
|
dhcpd-pools -c $top_srcdir/samples/dhcpd.conf -l $top_srcdir/samples/dhcpd.leases \
|
||||||
|
--mustach $top_srcdir/samples/mustach.template --skip-ok --warning 44 >> 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